Skip to content

Commit

Permalink
feat(spec): updated the sdk as per the api spec released on 2024-06-25 (
Browse files Browse the repository at this point in the history
#95)

Signed-off-by: Ujjwal Kumar <[email protected]>
  • Loading branch information
ujjwal-ibm authored Jun 25, 2024
1 parent c0a29f9 commit 2829cd5
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 47 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/IBM/vpc-go-sdk)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

# IBM Cloud VPC Go SDK Version 0.52.0
# IBM Cloud VPC Go SDK Version 0.53.0
Go client library to interact with the various [IBM Cloud VPC Services APIs](https://cloud.ibm.com/apidocs?category=vpc).

**Note:** Given the current version of all VPC SDKs across supported languages and the current VPC API specification, we retracted the vpc-go-sdk version 1.x to version v0.6.0, which had the same features as v1.0.1.
Consider using v0.52.0 from now on. Refrain from using commands like `go get -u ..` and `go get ..@latest` on go 1.14 and lower as you will not get the latest release.
Consider using v0.53.0 from now on. Refrain from using commands like `go get -u ..` and `go get ..@latest` on go 1.14 and lower as you will not get the latest release.

This SDK uses [Semantic Versioning](https://semver.org), and as such there may be backward-incompatible changes for any new `0.y.z` version.
## Table of Contents
Expand Down Expand Up @@ -64,7 +64,7 @@ Use this command to download and install the VPC Go SDK service to allow your Go
use it:

```
go get github.com/IBM/vpc-go-sdk@v0.52.0
go get github.com/IBM/vpc-go-sdk@v0.53.0
```


Expand All @@ -90,7 +90,7 @@ to your `Gopkg.toml` file. Here is an example:
```
[[constraint]]
name = "github.com/IBM/vpc-go-sdk/"
version = "0.52.0"
version = "0.53.0"
```

Then run `dep ensure`.
Expand Down
2 changes: 1 addition & 1 deletion common/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package common

// Version of the SDK
const Version = "0.52.0"
const Version = "0.53.0"
98 changes: 92 additions & 6 deletions vpcv1/vpc_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
// VpcV1 : The IBM Cloud Virtual Private Cloud (VPC) API can be used to programmatically provision and manage virtual
// server instances, along with subnets, volumes, load balancers, and more.
//
// API Version: 2024-06-05
// API Version: 2024-06-25
type VpcV1 struct {
Service *core.BaseService

Expand All @@ -47,7 +47,7 @@ type VpcV1 struct {
generation *int64

// The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2024-04-30`
// and `2024-06-05`.
// and `2024-06-25`.
Version *string
}

Expand All @@ -64,7 +64,7 @@ type VpcV1Options struct {
Authenticator core.Authenticator

// The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2024-04-30`
// and `2024-06-05`.
// and `2024-06-25`.
Version *string
}

Expand Down Expand Up @@ -129,7 +129,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) {
}

if options.Version == nil {
options.Version = core.StringPtr("2024-06-04")
options.Version = core.StringPtr("2024-06-11")
}

service = &VpcV1{
Expand Down Expand Up @@ -4239,6 +4239,9 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions *
if listImagesOptions.Visibility != nil {
builder.AddQuery("visibility", fmt.Sprint(*listImagesOptions.Visibility))
}
if listImagesOptions.UserDataFormat != nil {
builder.AddQuery("user_data_format", strings.Join(listImagesOptions.UserDataFormat, ","))
}

request, err := builder.Build()
if err != nil {
Expand Down Expand Up @@ -12832,7 +12835,8 @@ func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBa
// This request creates a new single-use console access token for a bare metal server. 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 bare metal server at a time.
// for a given bare metal server at a time. For this request to succeed, the server must have a `status` of `stopped`,
// `starting`, or `running`.
func (vpc *VpcV1) CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateBareMetalServerConsoleAccessTokenWithContext(context.Background(), createBareMetalServerConsoleAccessTokenOptions)
err = core.RepurposeSDKProblem(err, "")
Expand Down Expand Up @@ -14671,7 +14675,8 @@ func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Contex
}

// RestartBareMetalServer : Restart a bare metal server
// This request restarts a bare metal server. It will run immediately regardless of the state of the server.
// This request immediately restarts a bare metal server. For this request to succeed, the server must have a `status`
// of `running`.
func (vpc *VpcV1) RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.RestartBareMetalServerWithContext(context.Background(), restartBareMetalServerOptions)
err = core.RepurposeSDKProblem(err, "")
Expand Down Expand Up @@ -51835,6 +51840,15 @@ type Image struct {

StatusReasons []ImageStatusReason `json:"status_reasons" validate:"required"`

// The user data format for this image:
// - `cloud_init`: `user_data` will be interpreted according to the cloud-init standard
// - `esxi_kickstart`: `user_data` will be interpreted as a VMware ESXi installation script
// - `ipxe`: `user_data` will be interpreted as a single URL to an iPXE script or as the
// text of an iPXE script
//
// The value for this property is inherited from `operating_system.user_data_format`.
UserDataFormat *string `json:"user_data_format" validate:"required"`

// The visibility of this image.
// - `private`: Visible only to this account
// - `public`: Visible to all accounts.
Expand Down Expand Up @@ -51877,6 +51891,20 @@ const (
ImageStatusUnusableConst = "unusable"
)

// Constants associated with the Image.UserDataFormat property.
// The user data format for this image:
// - `cloud_init`: `user_data` will be interpreted according to the cloud-init standard
// - `esxi_kickstart`: `user_data` will be interpreted as a VMware ESXi installation script
// - `ipxe`: `user_data` will be interpreted as a single URL to an iPXE script or as the
// text of an iPXE script
//
// The value for this property is inherited from `operating_system.user_data_format`.
const (
ImageUserDataFormatCloudInitConst = "cloud_init"
ImageUserDataFormatEsxiKickstartConst = "esxi_kickstart"
ImageUserDataFormatIpxeConst = "ipxe"
)

// Constants associated with the Image.Visibility property.
// The visibility of this image.
// - `private`: Visible only to this account
Expand Down Expand Up @@ -51979,6 +52007,11 @@ func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error
err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "user_data_format", &obj.UserDataFormat)
if err != nil {
err = core.SDKErrorf(err, "", "user_data_format-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "visibility", &obj.Visibility)
if err != nil {
err = core.SDKErrorf(err, "", "visibility-error", common.GetComponentInfo())
Expand Down Expand Up @@ -62119,6 +62152,10 @@ type ListImagesOptions struct {
// Filters the collection to images with a `visibility` property matching the specified value.
Visibility *string `json:"visibility,omitempty"`

// Filters the collection to images with a `user_data_format` property matching one of the specified comma-separated
// values.
UserDataFormat []string `json:"user_data_format,omitempty"`

// Allows users to set headers on API requests
Headers map[string]string
}
Expand All @@ -62141,6 +62178,13 @@ const (
ListImagesOptionsVisibilityPublicConst = "public"
)

// Constants associated with the ListImagesOptions.UserDataFormat property.
const (
ListImagesOptionsUserDataFormatCloudInitConst = "cloud_init"
ListImagesOptionsUserDataFormatEsxiKickstartConst = "esxi_kickstart"
ListImagesOptionsUserDataFormatIpxeConst = "ipxe"
)

// NewListImagesOptions : Instantiate ListImagesOptions
func (*VpcV1) NewListImagesOptions() *ListImagesOptions {
return &ListImagesOptions{}
Expand Down Expand Up @@ -62182,6 +62226,12 @@ func (_options *ListImagesOptions) SetVisibility(visibility string) *ListImagesO
return _options
}

// SetUserDataFormat : Allow user to set UserDataFormat
func (_options *ListImagesOptions) SetUserDataFormat(userDataFormat []string) *ListImagesOptions {
_options.UserDataFormat = userDataFormat
return _options
}

// SetHeaders : Allow user to set Headers
func (options *ListImagesOptions) SetHeaders(param map[string]string) *ListImagesOptions {
options.Headers = param
Expand Down Expand Up @@ -71957,6 +72007,9 @@ func (options *ObsoleteImageOptions) SetHeaders(param map[string]string) *Obsole

// OperatingSystem : OperatingSystem struct
type OperatingSystem struct {
// Users may create new images with this operating system.
AllowUserImageCreation *bool `json:"allow_user_image_creation" validate:"required"`

// The operating system architecture.
Architecture *string `json:"architecture" validate:"required"`

Expand All @@ -71975,16 +72028,40 @@ type OperatingSystem struct {
// The globally unique name for this operating system.
Name *string `json:"name" validate:"required"`

// The user data format for this operating system:
// - `cloud_init`: `user_data` will be interpreted according to the cloud-init standard
// - `esxi_kickstart`: `user_data` will be interpreted as a VMware ESXi installation script
// - `ipxe`: `user_data` will be interpreted as a single URL to an iPXE script or as the
// text of an iPXE script.
UserDataFormat *string `json:"user_data_format" 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"`
}

// Constants associated with the OperatingSystem.UserDataFormat property.
// The user data format for this operating system:
// - `cloud_init`: `user_data` will be interpreted according to the cloud-init standard
// - `esxi_kickstart`: `user_data` will be interpreted as a VMware ESXi installation script
// - `ipxe`: `user_data` will be interpreted as a single URL to an iPXE script or as the
// text of an iPXE script.
const (
OperatingSystemUserDataFormatCloudInitConst = "cloud_init"
OperatingSystemUserDataFormatEsxiKickstartConst = "esxi_kickstart"
OperatingSystemUserDataFormatIpxeConst = "ipxe"
)

// 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, "allow_user_image_creation", &obj.AllowUserImageCreation)
if err != nil {
err = core.SDKErrorf(err, "", "allow_user_image_creation-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture)
if err != nil {
err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo())
Expand Down Expand Up @@ -72015,6 +72092,11 @@ func UnmarshalOperatingSystem(m map[string]json.RawMessage, result interface{})
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "user_data_format", &obj.UserDataFormat)
if err != nil {
err = core.SDKErrorf(err, "", "user_data_format-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "vendor", &obj.Vendor)
if err != nil {
err = core.SDKErrorf(err, "", "vendor-error", common.GetComponentInfo())
Expand Down Expand Up @@ -104954,6 +105036,8 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe
}

// InstancePrototypeInstanceByImage : Create an instance by using an image.
//
// The image's `user_data_format` must be `cloud_init`.
// Models which "extend" this model:
// - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment
// - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface
Expand Down Expand Up @@ -106282,6 +106366,8 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s
}

// InstanceTemplatePrototypeInstanceTemplateByImage : Create an instance template that creates instances by using an image.
//
// The image's `user_data_format` must be `cloud_init`.
// Models which "extend" this model:
// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment
// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface
Expand Down
Loading

0 comments on commit 2829cd5

Please sign in to comment.