alServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter
func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"bare_metal_server_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.BareMetalServerID,
"network_interface_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_bare_metal_server_network_interface_floating_ips", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface
// This request disassociates the specified floating IP from the specified bare metal server network interface.
func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter
func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"bare_metal_server_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID,
"network_interface_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID,
"id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "remove_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP
// This request retrieves a specified floating IP if it is associated with the bare metal server network interface
// specified in the URL.
func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter
func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"bare_metal_server_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID,
"network_interface_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID,
"id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a bare metal server network interface
// This request associates the specified floating IP with the specified bare metal server network interface. If
// `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat`
// is `true`, this replaces any existing association.
//
// The existing floating IP must:
// - not be required by another resource, such as a public gateway
// - be in the same `zone` as the bare metal server
//
// A request body is not required, and if provided, is ignored.
func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) {
result, response, err = vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter
func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"bare_metal_server_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID,
"network_interface_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID,
"id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.ID,
}
builder := core.NewRequestBuilder(core.PUT)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "add_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListBareMetalServerNetworkInterfaceIps : List the primary reserved IP for a bare metal server network interface
// This request lists the primary reserved IP for a bare metal server network interface.
// Deprecated: this method is deprecated and may be removed in a future release.
func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListBareMetalServerNetworkInterfaceIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceIps method which supports a Context parameter
// Deprecated: this method is deprecated and may be removed in a future release.
func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) {
core.GetLogger().Warn("A deprecated operation has been invoked: ListBareMetalServerNetworkInterfaceIps")
err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"bare_metal_server_id": *listBareMetalServerNetworkInterfaceIpsOptions.BareMetalServerID,
"network_interface_id": *listBareMetalServerNetworkInterfaceIpsOptions.NetworkInterfaceID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceIps")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listBareMetalServerNetworkInterfaceIpsOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_bare_metal_server_network_interface_ips", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetBareMetalServerNetworkInterfaceIP : Retrieve the primary reserved IP
// This request retrieves the primary reserved IP for a bare metal server network interface.
// Deprecated: this method is deprecated and may be removed in a future release.
func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter
// Deprecated: this method is deprecated and may be removed in a future release.
func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) {
core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterfaceIP")
err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID,
"network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID,
"id": *getBareMetalServerNetworkInterfaceIPOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_bare_metal_server_network_interface_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteBareMetalServer : Delete a bare metal server
// This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the
// bare metal server network interfaces are implicitly disassociated.
func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteBareMetalServerWithContext is an alternate form of the DeleteBareMetalServer method which supports a Context parameter
func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteBareMetalServerOptions, "deleteBareMetalServerOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *deleteBareMetalServerOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteBareMetalServerOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_bare_metal_server", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// GetBareMetalServer : Retrieve a bare metal server
// This request retrieves a single bare metal server specified by the identifier in the URL.
func (vpc *VpcV1) GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetBareMetalServerWithContext is an alternate form of the GetBareMetalServer method which supports a Context parameter
func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getBareMetalServerOptions, "getBareMetalServerOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *getBareMetalServerOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getBareMetalServerOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_bare_metal_server", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateBareMetalServer : Update a bare metal server
// This request updates a bare metal server with the information in a provided patch. The bare metal server patch object
// is structured in the same way as a retrieved bare metal server and contains only the information to be updated.
//
// For this request to succeed, the properties in the request must adhere to the `allowed_use` property of the disk
// referenced in the server's `boot_target`.
func (vpc *VpcV1) UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdateBareMetalServerWithContext is an alternate form of the UpdateBareMetalServer method which supports a Context parameter
func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updateBareMetalServerOptions, "updateBareMetalServerOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *updateBareMetalServerOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateBareMetalServerOptions.Headers {
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(updateBareMetalServerOptions.BareMetalServerPatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_bare_metal_server", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateFirmwareForBareMetalServer : Update firmware for a bare metal server
// This request updates a bare metal server to the latest available firmware. The server must be stopped.
func (vpc *VpcV1) UpdateFirmwareForBareMetalServer(updateFirmwareForBareMetalServerOptions *UpdateFirmwareForBareMetalServerOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.UpdateFirmwareForBareMetalServerWithContext(context.Background(), updateFirmwareForBareMetalServerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdateFirmwareForBareMetalServerWithContext is an alternate form of the UpdateFirmwareForBareMetalServer method which supports a Context parameter
func (vpc *VpcV1) UpdateFirmwareForBareMetalServerWithContext(ctx context.Context, updateFirmwareForBareMetalServerOptions *UpdateFirmwareForBareMetalServerOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updateFirmwareForBareMetalServerOptions, "updateFirmwareForBareMetalServerOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateFirmwareForBareMetalServerOptions, "updateFirmwareForBareMetalServerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *updateFirmwareForBareMetalServerOptions.ID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/firmware/update`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFirmwareForBareMetalServer")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateFirmwareForBareMetalServerOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
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 updateFirmwareForBareMetalServerOptions.AutoStart != nil {
body["auto_start"] = updateFirmwareForBareMetalServerOptions.AutoStart
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "update_firmware_for_bare_metal_server", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// GetBareMetalServerInitialization : Retrieve initialization configuration for a bare metal server
// This request retrieves configuration used to initialize the bare metal server, such as the image used, SSH keys, and
// any configured usernames and passwords. These can subsequently be changed on the server and therefore may not be
// current.
func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetBareMetalServerInitializationWithContext is an alternate form of the GetBareMetalServerInitialization method which supports a Context parameter
func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Context, getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *getBareMetalServerInitializationOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/initialization`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_bare_metal_server_initialization", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerInitialization)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ReplaceBareMetalServerInitialization : Reinitialize a bare metal server
// This request reinitializes a bare metal server with the specified image and SSH keys. The server must be stopped.
// Upon successful reinitiatilization, the bare metal server will be started automatically.
//
// For this request to succeed, the properties of the server which would result from the reinitialization must adhere to
// the specified image's `allowed_use` property.
func (vpc *VpcV1) ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptions *ReplaceBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) {
result, response, err = vpc.ReplaceBareMetalServerInitializationWithContext(context.Background(), replaceBareMetalServerInitializationOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ReplaceBareMetalServerInitializationWithContext is an alternate form of the ReplaceBareMetalServerInitialization method which supports a Context parameter
func (vpc *VpcV1) ReplaceBareMetalServerInitializationWithContext(ctx context.Context, replaceBareMetalServerInitializationOptions *ReplaceBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(replaceBareMetalServerInitializationOptions, "replaceBareMetalServerInitializationOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(replaceBareMetalServerInitializationOptions, "replaceBareMetalServerInitializationOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *replaceBareMetalServerInitializationOptions.ID,
}
builder := core.NewRequestBuilder(core.PUT)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/initialization`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceBareMetalServerInitialization")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range replaceBareMetalServerInitializationOptions.Headers {
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 replaceBareMetalServerInitializationOptions.Image != nil {
body["image"] = replaceBareMetalServerInitializationOptions.Image
}
if replaceBareMetalServerInitializationOptions.Keys != nil {
body["keys"] = replaceBareMetalServerInitializationOptions.Keys
}
if replaceBareMetalServerInitializationOptions.UserData != nil {
body["user_data"] = replaceBareMetalServerInitializationOptions.UserData
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "replace_bare_metal_server_initialization", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerInitialization)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// RestartBareMetalServer : Restart a bare metal 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, "")
return
}
// RestartBareMetalServerWithContext is an alternate form of the RestartBareMetalServer method which supports a Context parameter
func (vpc *VpcV1) RestartBareMetalServerWithContext(ctx context.Context, restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(restartBareMetalServerOptions, "restartBareMetalServerOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(restartBareMetalServerOptions, "restartBareMetalServerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *restartBareMetalServerOptions.ID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/restart`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RestartBareMetalServer")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range restartBareMetalServerOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "restart_bare_metal_server", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// StartBareMetalServer : Start a bare metal server
// This request starts a bare metal server. It will run immediately provided the server is stopped.
func (vpc *VpcV1) StartBareMetalServer(startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.StartBareMetalServerWithContext(context.Background(), startBareMetalServerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// StartBareMetalServerWithContext is an alternate form of the StartBareMetalServer method which supports a Context parameter
func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(startBareMetalServerOptions, "startBareMetalServerOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(startBareMetalServerOptions, "startBareMetalServerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *startBareMetalServerOptions.ID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/start`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StartBareMetalServer")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range startBareMetalServerOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "start_bare_metal_server", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// StopBareMetalServer : Stop a bare metal server
// This request stops a bare metal server. It will run immediately provided the server is running. Note: A soft stop may
// not complete as it relies on the operating system to perform the operation.
func (vpc *VpcV1) StopBareMetalServer(stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.StopBareMetalServerWithContext(context.Background(), stopBareMetalServerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// StopBareMetalServerWithContext is an alternate form of the StopBareMetalServer method which supports a Context parameter
func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(stopBareMetalServerOptions, "stopBareMetalServerOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(stopBareMetalServerOptions, "stopBareMetalServerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *stopBareMetalServerOptions.ID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/stop`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StopBareMetalServer")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range stopBareMetalServerOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
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 stopBareMetalServerOptions.Type != nil {
body["type"] = stopBareMetalServerOptions.Type
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "stop_bare_metal_server", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// ListVolumeProfiles : List volume profiles
// This request lists [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-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) {
result, response, err = vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listVolumeProfilesOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_volume_profiles", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getVolumeProfileOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_volume_profile", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListVolumes : List volumes
// This request lists 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) {
result, response, err = vpc.ListVolumesWithContext(context.Background(), listVolumesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listVolumesOptions.Headers {
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.AttachmentState != nil {
builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState))
}
if listVolumesOptions.Encryption != nil {
builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption))
}
if listVolumesOptions.Name != nil {
builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name))
}
if listVolumesOptions.OperatingSystemFamily != nil {
builder.AddQuery("operating_system.family", fmt.Sprint(*listVolumesOptions.OperatingSystemFamily))
}
if listVolumesOptions.OperatingSystemArchitecture != nil {
builder.AddQuery("operating_system.architecture", fmt.Sprint(*listVolumesOptions.OperatingSystemArchitecture))
}
if listVolumesOptions.Tag != nil {
builder.AddQuery("tag", fmt.Sprint(*listVolumesOptions.Tag))
}
if listVolumesOptions.ZoneName != nil {
builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_volumes", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.CreateVolumeWithContext(context.Background(), createVolumeOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createVolumeOptions, "createVolumeOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVolume")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createVolumeOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_volume", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
response, err = vpc.DeleteVolumeWithContext(context.Background(), deleteVolumeOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteVolumeOptions, "deleteVolumeOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVolume")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteVolumeOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
if deleteVolumeOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*deleteVolumeOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_volume", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetVolumeWithContext(context.Background(), getVolumeOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getVolumeOptions, "getVolumeOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolume")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getVolumeOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_volume", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateVolumeOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddHeader("Content-Type", "application/merge-patch+json")
if updateVolumeOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*updateVolumeOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
_, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_volume", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListVolumeInstanceProfiles : List instance profiles compatible with a volume
// This request lists instance profiles compatible with a volume's
// `allowed_use.instance`, `operating_system.architecture` and
// `operating_system.user_data_format` properties, sorted by ascending `name` property values. The specified volume must
// be bootable (have an `operating_system` property).
func (vpc *VpcV1) ListVolumeInstanceProfiles(listVolumeInstanceProfilesOptions *ListVolumeInstanceProfilesOptions) (result *VolumeInstanceProfileCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListVolumeInstanceProfilesWithContext(context.Background(), listVolumeInstanceProfilesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListVolumeInstanceProfilesWithContext is an alternate form of the ListVolumeInstanceProfiles method which supports a Context parameter
func (vpc *VpcV1) ListVolumeInstanceProfilesWithContext(ctx context.Context, listVolumeInstanceProfilesOptions *ListVolumeInstanceProfilesOptions) (result *VolumeInstanceProfileCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listVolumeInstanceProfilesOptions, "listVolumeInstanceProfilesOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listVolumeInstanceProfilesOptions, "listVolumeInstanceProfilesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *listVolumeInstanceProfilesOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}/instance_profiles`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeInstanceProfiles")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listVolumeInstanceProfilesOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listVolumeInstanceProfilesOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listVolumeInstanceProfilesOptions.Start))
}
if listVolumeInstanceProfilesOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listVolumeInstanceProfilesOptions.Limit))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_volume_instance_profiles", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeInstanceProfileCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListSnapshotConsistencyGroups : List snapshot consistency groups
// This request lists snapshot consistency groups in the region. A snapshot consistency group is a collection of
// individual snapshots taken at the same time.
func (vpc *VpcV1) ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListSnapshotConsistencyGroupsWithContext(context.Background(), listSnapshotConsistencyGroupsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListSnapshotConsistencyGroupsWithContext is an alternate form of the ListSnapshotConsistencyGroups method which supports a Context parameter
func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) {
err = core.ValidateStruct(listSnapshotConsistencyGroupsOptions, "listSnapshotConsistencyGroupsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotConsistencyGroups")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listSnapshotConsistencyGroupsOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listSnapshotConsistencyGroupsOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Start))
}
if listSnapshotConsistencyGroupsOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Limit))
}
if listSnapshotConsistencyGroupsOptions.ResourceGroupID != nil {
builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.ResourceGroupID))
}
if listSnapshotConsistencyGroupsOptions.Name != nil {
builder.AddQuery("name", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Name))
}
if listSnapshotConsistencyGroupsOptions.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Sort))
}
if listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID != nil {
builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_snapshot_consistency_groups", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroupCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateSnapshotConsistencyGroup : Create a snapshot consistency group
// This request creates a new snapshot consistency group from a snapshot consistency group object. The prototype object
// is structured in the same way as a retrieved consistency group, and contains the information necessary to provision
// the new snapshot consistency group.
func (vpc *VpcV1) CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateSnapshotConsistencyGroupWithContext(context.Background(), createSnapshotConsistencyGroupOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreateSnapshotConsistencyGroupWithContext is an alternate form of the CreateSnapshotConsistencyGroup method which supports a Context parameter
func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotConsistencyGroup")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createSnapshotConsistencyGroupOptions.Headers {
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(createSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_snapshot_consistency_group", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteSnapshotConsistencyGroup : Delete a snapshot consistency group
// This request deletes snapshot consistency group. This operation cannot be reversed. If the
// `delete_snapshots_on_delete` property is `true`, all snapshots in the consistency group will also be deleted.
func (vpc *VpcV1) DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) {
result, response, err = vpc.DeleteSnapshotConsistencyGroupWithContext(context.Background(), deleteSnapshotConsistencyGroupOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteSnapshotConsistencyGroupWithContext is an alternate form of the DeleteSnapshotConsistencyGroup method which supports a Context parameter
func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *deleteSnapshotConsistencyGroupOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotConsistencyGroup")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteSnapshotConsistencyGroupOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "delete_snapshot_consistency_group", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetSnapshotConsistencyGroup : Retrieve a snapshot consistency group
// This request retrieves a single snapshot consistency group specified by the identifier in the URL.
func (vpc *VpcV1) GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetSnapshotConsistencyGroupWithContext(context.Background(), getSnapshotConsistencyGroupOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetSnapshotConsistencyGroupWithContext is an alternate form of the GetSnapshotConsistencyGroup method which supports a Context parameter
func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *getSnapshotConsistencyGroupOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotConsistencyGroup")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getSnapshotConsistencyGroupOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_snapshot_consistency_group", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateSnapshotConsistencyGroup : Update a snapshot consistency group
// This request updates a snapshot consistency group with the information in a provided snapshot consistency group
// patch. The snapshot consistency group patch object is structured in the same way as a retrieved snapshot consistency
// group and contains only the information to be updated.
func (vpc *VpcV1) UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateSnapshotConsistencyGroupWithContext(context.Background(), updateSnapshotConsistencyGroupOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdateSnapshotConsistencyGroupWithContext is an alternate form of the UpdateSnapshotConsistencyGroup method which supports a Context parameter
func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *updateSnapshotConsistencyGroupOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshotConsistencyGroup")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateSnapshotConsistencyGroupOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddHeader("Content-Type", "application/merge-patch+json")
if updateSnapshotConsistencyGroupOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotConsistencyGroupOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
_, err = builder.SetBodyContentJSON(updateSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_snapshot_consistency_group", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteSnapshots : Delete a filtered collection of snapshots
// This request deletes snapshots that match the specified filter. This operation cannot be reversed.
func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteSnapshotsWithContext is an alternate form of the DeleteSnapshots method which supports a Context parameter
func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteSnapshotsOptions, "deleteSnapshotsOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteSnapshotsOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID))
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_snapshots", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// ListSnapshots : List snapshots
// This request lists snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is
// created.
func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListSnapshotsWithContext is an alternate form of the ListSnapshots method which supports a Context parameter
func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) {
err = core.ValidateStruct(listSnapshotsOptions, "listSnapshotsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listSnapshotsOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listSnapshotsOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start))
}
if listSnapshotsOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listSnapshotsOptions.Limit))
}
if listSnapshotsOptions.Tag != nil {
builder.AddQuery("tag", fmt.Sprint(*listSnapshotsOptions.Tag))
}
if listSnapshotsOptions.ResourceGroupID != nil {
builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotsOptions.ResourceGroupID))
}
if listSnapshotsOptions.Name != nil {
builder.AddQuery("name", fmt.Sprint(*listSnapshotsOptions.Name))
}
if listSnapshotsOptions.SourceVolumeID != nil {
builder.AddQuery("source_volume.id", fmt.Sprint(*listSnapshotsOptions.SourceVolumeID))
}
if listSnapshotsOptions.SourceVolumeCRN != nil {
builder.AddQuery("source_volume.crn", fmt.Sprint(*listSnapshotsOptions.SourceVolumeCRN))
}
if listSnapshotsOptions.SourceImageID != nil {
builder.AddQuery("source_image.id", fmt.Sprint(*listSnapshotsOptions.SourceImageID))
}
if listSnapshotsOptions.SourceImageCRN != nil {
builder.AddQuery("source_image.crn", fmt.Sprint(*listSnapshotsOptions.SourceImageCRN))
}
if listSnapshotsOptions.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listSnapshotsOptions.Sort))
}
if listSnapshotsOptions.BackupPolicyPlanID != nil {
builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotsOptions.BackupPolicyPlanID))
}
if listSnapshotsOptions.CopiesID != nil {
builder.AddQuery("copies[].id", fmt.Sprint(*listSnapshotsOptions.CopiesID))
}
if listSnapshotsOptions.CopiesName != nil {
builder.AddQuery("copies[].name", fmt.Sprint(*listSnapshotsOptions.CopiesName))
}
if listSnapshotsOptions.CopiesCRN != nil {
builder.AddQuery("copies[].crn", fmt.Sprint(*listSnapshotsOptions.CopiesCRN))
}
if listSnapshotsOptions.CopiesRemoteRegionName != nil {
builder.AddQuery("copies[].remote.region.name", fmt.Sprint(*listSnapshotsOptions.CopiesRemoteRegionName))
}
if listSnapshotsOptions.SourceSnapshotID != nil {
builder.AddQuery("source_snapshot.id", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotID))
}
if listSnapshotsOptions.SourceSnapshotRemoteRegionName != nil {
builder.AddQuery("source_snapshot.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotRemoteRegionName))
}
if listSnapshotsOptions.SourceVolumeRemoteRegionName != nil {
builder.AddQuery("source_volume.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceVolumeRemoteRegionName))
}
if listSnapshotsOptions.SourceImageRemoteRegionName != nil {
builder.AddQuery("source_image.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceImageRemoteRegionName))
}
if listSnapshotsOptions.ClonesZoneName != nil {
builder.AddQuery("clones[].zone.name", fmt.Sprint(*listSnapshotsOptions.ClonesZoneName))
}
if listSnapshotsOptions.SnapshotConsistencyGroupID != nil {
builder.AddQuery("snapshot_consistency_group.id", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupID))
}
if listSnapshotsOptions.SnapshotConsistencyGroupCRN != nil {
builder.AddQuery("snapshot_consistency_group.crn", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupCRN))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_snapshots", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateSnapshot : Create a snapshot
// This request creates a new snapshot from a snapshot prototype object. The prototype object is structured in the same
// way as a retrieved snapshot, and contains the information necessary to provision the new snapshot.
func (vpc *VpcV1) CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateSnapshotWithContext(context.Background(), createSnapshotOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreateSnapshotWithContext is an alternate form of the CreateSnapshot method which supports a Context parameter
func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createSnapshotOptions, "createSnapshotOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createSnapshotOptions, "createSnapshotOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshot")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createSnapshotOptions.Headers {
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(createSnapshotOptions.SnapshotPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_snapshot", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteSnapshot : Delete a snapshot
// This request deletes a snapshot. This operation cannot be reversed.
func (vpc *VpcV1) DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeleteSnapshotWithContext(context.Background(), deleteSnapshotOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteSnapshotWithContext is an alternate form of the DeleteSnapshot method which supports a Context parameter
func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteSnapshotOptions, "deleteSnapshotOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteSnapshotOptions, "deleteSnapshotOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *deleteSnapshotOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshot")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteSnapshotOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
if deleteSnapshotOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*deleteSnapshotOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_snapshot", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// GetSnapshot : Retrieve a snapshot
// This request retrieves a single snapshot specified by the identifier in the URL.
func (vpc *VpcV1) GetSnapshot(getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetSnapshotWithContext(context.Background(), getSnapshotOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetSnapshotWithContext is an alternate form of the GetSnapshot method which supports a Context parameter
func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getSnapshotOptions, "getSnapshotOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getSnapshotOptions, "getSnapshotOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *getSnapshotOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshot")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getSnapshotOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_snapshot", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateSnapshot : Update a snapshot
// This request updates a snapshot with the information in a provided snapshot patch. The snapshot consistency group
// patch object is structured in the same way as a retrieved snapshot and contains only the information to be updated.
func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdateSnapshotWithContext is an alternate form of the UpdateSnapshot method which supports a Context parameter
func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updateSnapshotOptions, "updateSnapshotOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *updateSnapshotOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateSnapshotOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddHeader("Content-Type", "application/merge-patch+json")
if updateSnapshotOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
_, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_snapshot", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListSnapshotClones : List clones for a snapshot
// This request lists clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone.
func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListSnapshotClonesWithContext is an alternate form of the ListSnapshotClones method which supports a Context parameter
func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listSnapshotClonesOptions, "listSnapshotClonesOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listSnapshotClonesOptions, "listSnapshotClonesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *listSnapshotClonesOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listSnapshotClonesOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_snapshot_clones", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCloneCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteSnapshotClone : Delete a snapshot clone
// This request deletes a snapshot clone. This operation cannot be reversed, but an equivalent clone may be recreated
// from the snapshot.
func (vpc *VpcV1) DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteSnapshotCloneWithContext is an alternate form of the DeleteSnapshotClone method which supports a Context parameter
func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *deleteSnapshotCloneOptions.ID,
"zone_name": *deleteSnapshotCloneOptions.ZoneName,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteSnapshotCloneOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_snapshot_clone", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// GetSnapshotClone : Retrieve a snapshot clone
// This request retrieves a single clone specified by the snapshot identifier and zone name in the URL.
func (vpc *VpcV1) GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetSnapshotCloneWithContext(context.Background(), getSnapshotCloneOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetSnapshotCloneWithContext is an alternate form of the GetSnapshotClone method which supports a Context parameter
func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getSnapshotCloneOptions, "getSnapshotCloneOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getSnapshotCloneOptions, "getSnapshotCloneOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *getSnapshotCloneOptions.ID,
"zone_name": *getSnapshotCloneOptions.ZoneName,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotClone")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getSnapshotCloneOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_snapshot_clone", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateSnapshotClone : Create a clone for a snapshot
// This request creates a new clone for a snapshot in the specified zone. A request body is not required, and if
// provided, is ignored. If the snapshot already has a clone in the zone, it is returned.
func (vpc *VpcV1) CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreateSnapshotCloneWithContext is an alternate form of the CreateSnapshotClone method which supports a Context parameter
func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createSnapshotCloneOptions, "createSnapshotCloneOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *createSnapshotCloneOptions.ID,
"zone_name": *createSnapshotCloneOptions.ZoneName,
}
builder := core.NewRequestBuilder(core.PUT)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createSnapshotCloneOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_snapshot_clone", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListSnapshotInstanceProfiles : List instance profiles compatible with a snapshot
// This request lists instance profiles compatible with a snapshot's
// `allowed_use.instance`, `operating_system.architecture` and
// `operating_system.user_data_format` properties, sorted by ascending `name` property values. The specified snapshot
// must be bootable.
func (vpc *VpcV1) ListSnapshotInstanceProfiles(listSnapshotInstanceProfilesOptions *ListSnapshotInstanceProfilesOptions) (result *SnapshotInstanceProfileCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListSnapshotInstanceProfilesWithContext(context.Background(), listSnapshotInstanceProfilesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListSnapshotInstanceProfilesWithContext is an alternate form of the ListSnapshotInstanceProfiles method which supports a Context parameter
func (vpc *VpcV1) ListSnapshotInstanceProfilesWithContext(ctx context.Context, listSnapshotInstanceProfilesOptions *ListSnapshotInstanceProfilesOptions) (result *SnapshotInstanceProfileCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listSnapshotInstanceProfilesOptions, "listSnapshotInstanceProfilesOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listSnapshotInstanceProfilesOptions, "listSnapshotInstanceProfilesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *listSnapshotInstanceProfilesOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/instance_profiles`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotInstanceProfiles")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listSnapshotInstanceProfilesOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listSnapshotInstanceProfilesOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listSnapshotInstanceProfilesOptions.Start))
}
if listSnapshotInstanceProfilesOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listSnapshotInstanceProfilesOptions.Limit))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_snapshot_instance_profiles", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotInstanceProfileCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListShareProfiles : List file share profiles
// This request lists [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) available in
// the region. A file share profile specifies the performance characteristics and pricing model for a file share.
func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListShareProfilesWithContext is an alternate form of the ListShareProfiles method which supports a Context parameter
func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) {
err = core.ValidateStruct(listShareProfilesOptions, "listShareProfilesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listShareProfilesOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listShareProfilesOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start))
}
if listShareProfilesOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listShareProfilesOptions.Limit))
}
if listShareProfilesOptions.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listShareProfilesOptions.Sort))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_share_profiles", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetShareProfile : Retrieve a file share profile
// This request retrieves a single file share profile specified by the name in the URL.
func (vpc *VpcV1) GetShareProfile(getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetShareProfileWithContext is an alternate form of the GetShareProfile method which supports a Context parameter
func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getShareProfileOptions, "getShareProfileOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"name": *getShareProfileOptions.Name,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles/{name}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getShareProfileOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_share_profile", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListShares : List file shares
// This request lists file shares in the region.
func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListSharesWithContext(context.Background(), listSharesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListSharesWithContext is an alternate form of the ListShares method which supports a Context parameter
func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) {
err = core.ValidateStruct(listSharesOptions, "listSharesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listSharesOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listSharesOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start))
}
if listSharesOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listSharesOptions.Limit))
}
if listSharesOptions.ResourceGroupID != nil {
builder.AddQuery("resource_group.id", fmt.Sprint(*listSharesOptions.ResourceGroupID))
}
if listSharesOptions.Name != nil {
builder.AddQuery("name", fmt.Sprint(*listSharesOptions.Name))
}
if listSharesOptions.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listSharesOptions.Sort))
}
if listSharesOptions.ReplicationRole != nil {
builder.AddQuery("replication_role", fmt.Sprint(*listSharesOptions.ReplicationRole))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_shares", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateShare : Create a file share
// This request provisions new file shares from a share prototype object. The new file shares can be a standalone share,
// a replica share, or both a source and replica share.
//
// The prototype object is structured in the same way as a retrieved share, and contains the information necessary to
// provision the new file shares.
func (vpc *VpcV1) CreateShare(createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateShareWithContext(context.Background(), createShareOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreateShareWithContext is an alternate form of the CreateShare method which supports a Context parameter
func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createShareOptions, "createShareOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createShareOptions, "createShareOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createShareOptions.Headers {
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(createShareOptions.SharePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_share", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteShare : Delete a file share
// This request deletes a share. This operation cannot be reversed. A share cannot be deleted if it:
// - has share mount targets
// - has a `lifecycle_state` of `updating`
// - has a replication operation in progress
//
// If the request is accepted, the share `lifecycle_state` will be set to `deleting`. Once deletion processing
// completes, it will no longer be retrievable.
func (vpc *VpcV1) DeleteShare(deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) {
result, response, err = vpc.DeleteShareWithContext(context.Background(), deleteShareOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteShareWithContext is an alternate form of the DeleteShare method which supports a Context parameter
func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteShareOptions, "deleteShareOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteShareOptions, "deleteShareOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *deleteShareOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShare")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteShareOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
if deleteShareOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*deleteShareOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "delete_share", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetShare : Retrieve a file share
// This request retrieves a single file share specified by the identifier in the URL.
func (vpc *VpcV1) GetShare(getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetShareWithContext(context.Background(), getShareOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetShareWithContext is an alternate form of the GetShare method which supports a Context parameter
func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getShareOptions, "getShareOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getShareOptions, "getShareOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *getShareOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getShareOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_share", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateShare : Update a file share
// This request updates a share with the information in a provided share patch. The share patch object is structured in
// the same way as a retrieved share and contains only the information to be updated.
func (vpc *VpcV1) UpdateShare(updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateShareWithContext(context.Background(), updateShareOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdateShareWithContext is an alternate form of the UpdateShare method which supports a Context parameter
func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updateShareOptions, "updateShareOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateShareOptions, "updateShareOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *updateShareOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateShareOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddHeader("Content-Type", "application/merge-patch+json")
if updateShareOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*updateShareOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
_, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_share", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListShareAccessorBindings : List accessor bindings for a file share
// This request lists accessor bindings for a share. Each accessor binding identifies a resource (possibly in another
// account) with access to this file share including its snapshots.
//
// The share accessor bindings will be sorted by their `created_at` property values, with newest bindings first.
func (vpc *VpcV1) ListShareAccessorBindings(listShareAccessorBindingsOptions *ListShareAccessorBindingsOptions) (result *ShareAccessorBindingCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListShareAccessorBindingsWithContext(context.Background(), listShareAccessorBindingsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListShareAccessorBindingsWithContext is an alternate form of the ListShareAccessorBindings method which supports a Context parameter
func (vpc *VpcV1) ListShareAccessorBindingsWithContext(ctx context.Context, listShareAccessorBindingsOptions *ListShareAccessorBindingsOptions) (result *ShareAccessorBindingCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listShareAccessorBindingsOptions, "listShareAccessorBindingsOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listShareAccessorBindingsOptions, "listShareAccessorBindingsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *listShareAccessorBindingsOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}/accessor_bindings`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareAccessorBindings")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listShareAccessorBindingsOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listShareAccessorBindingsOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listShareAccessorBindingsOptions.Start))
}
if listShareAccessorBindingsOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listShareAccessorBindingsOptions.Limit))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_share_accessor_bindings", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareAccessorBindingCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteShareAccessorBinding : Delete a file share accessor binding
// This request deletes a share accessor binding. This operation cannot be reversed.
func (vpc *VpcV1) DeleteShareAccessorBinding(deleteShareAccessorBindingOptions *DeleteShareAccessorBindingOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeleteShareAccessorBindingWithContext(context.Background(), deleteShareAccessorBindingOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteShareAccessorBindingWithContext is an alternate form of the DeleteShareAccessorBinding method which supports a Context parameter
func (vpc *VpcV1) DeleteShareAccessorBindingWithContext(ctx context.Context, deleteShareAccessorBindingOptions *DeleteShareAccessorBindingOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteShareAccessorBindingOptions, "deleteShareAccessorBindingOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteShareAccessorBindingOptions, "deleteShareAccessorBindingOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"share_id": *deleteShareAccessorBindingOptions.ShareID,
"id": *deleteShareAccessorBindingOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/accessor_bindings/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareAccessorBinding")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteShareAccessorBindingOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_share_accessor_binding", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// GetShareAccessorBinding : Retrieve a file share accessor binding
// This request retrieves a single accessor binding specified by the identifier in the URL.
func (vpc *VpcV1) GetShareAccessorBinding(getShareAccessorBindingOptions *GetShareAccessorBindingOptions) (result *ShareAccessorBinding, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetShareAccessorBindingWithContext(context.Background(), getShareAccessorBindingOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetShareAccessorBindingWithContext is an alternate form of the GetShareAccessorBinding method which supports a Context parameter
func (vpc *VpcV1) GetShareAccessorBindingWithContext(ctx context.Context, getShareAccessorBindingOptions *GetShareAccessorBindingOptions) (result *ShareAccessorBinding, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getShareAccessorBindingOptions, "getShareAccessorBindingOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getShareAccessorBindingOptions, "getShareAccessorBindingOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"share_id": *getShareAccessorBindingOptions.ShareID,
"id": *getShareAccessorBindingOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/accessor_bindings/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareAccessorBinding")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getShareAccessorBindingOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_share_accessor_binding", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareAccessorBinding)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// FailoverShare : Failover to replica file share
// This request triggers a failover to the replica file share specified by the identifier in the URL. The failover
// cannot be started if a source share or the replica share has a `lifecycle_state` of `updating`, or has a replication
// operation in progress.
//
// If `fallback_policy` is specified as `split`, and the request is accepted but the failover operation cannot be
// performed, a split will be triggered.
func (vpc *VpcV1) FailoverShare(failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.FailoverShareWithContext(context.Background(), failoverShareOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// FailoverShareWithContext is an alternate form of the FailoverShare method which supports a Context parameter
func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(failoverShareOptions, "failoverShareOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(failoverShareOptions, "failoverShareOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"share_id": *failoverShareOptions.ShareID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/failover`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "FailoverShare")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range failoverShareOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
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 failoverShareOptions.FallbackPolicy != nil {
body["fallback_policy"] = failoverShareOptions.FallbackPolicy
}
if failoverShareOptions.Timeout != nil {
body["timeout"] = failoverShareOptions.Timeout
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "failover_share", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// ListShareMountTargets : List mount targets for a file share
// This request lists mount targets for a file share. A mount target is a network endpoint at which a file share may be
// mounted. The file share can be mounted by clients in the same VPC and zone after creating share mount targets.
//
// The share mount targets will be sorted by their `created_at` property values, with newest targets first.
func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter
func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"share_id": *listShareMountTargetsOptions.ShareID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listShareMountTargetsOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listShareMountTargetsOptions.Name != nil {
builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name))
}
if listShareMountTargetsOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start))
}
if listShareMountTargetsOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.Limit))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_share_mount_targets", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateShareMountTarget : Create a mount target for a file share
// This request creates a new share mount target from a share mount target prototype object.
//
// The prototype object is structured in the same way as a retrieved share mount target, and contains the information
// necessary to provision the new file share mount target.
func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter
func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"share_id": *createShareMountTargetOptions.ShareID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createShareMountTargetOptions.Headers {
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(createShareMountTargetOptions.ShareMountTargetPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_share_mount_target", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteShareMountTarget : Delete a file share mount target
// This request deletes a share mount target. This operation cannot be reversed.
//
// If the request is accepted, the share mount target `lifecycle_state` will be set to
// `deleting`. Once deletion processing completes, it will no longer be retrievable.
func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) {
result, response, err = vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter
func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"share_id": *deleteShareMountTargetOptions.ShareID,
"id": *deleteShareMountTargetOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteShareMountTargetOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "delete_share_mount_target", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetShareMountTarget : Retrieve a file share mount target
// This request retrieves a single share mount target specified by the identifier in the URL.
func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter
func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"share_id": *getShareMountTargetOptions.ShareID,
"id": *getShareMountTargetOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getShareMountTargetOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_share_mount_target", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateShareMountTarget : Update a file share mount target
// This request updates a share mount target with the information provided in a share mount target patch object. The
// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain
// only the information to be updated.
func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter
func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"share_id": *updateShareMountTargetOptions.ShareID,
"id": *updateShareMountTargetOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateShareMountTargetOptions.Headers {
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(updateShareMountTargetOptions.ShareMountTargetPatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_share_mount_target", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListShareSnapshots : List file share snapshots
// This request lists snapshots for the specified file share, or across all accessible file shares. A snapshot preserves
// the data of a share at the time the snapshot was captured.
//
// If the file share is a replica, the list will contain snapshots corresponding to snapshots on the source.
func (vpc *VpcV1) ListShareSnapshots(listShareSnapshotsOptions *ListShareSnapshotsOptions) (result *ShareSnapshotCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListShareSnapshotsWithContext(context.Background(), listShareSnapshotsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListShareSnapshotsWithContext is an alternate form of the ListShareSnapshots method which supports a Context parameter
func (vpc *VpcV1) ListShareSnapshotsWithContext(ctx context.Context, listShareSnapshotsOptions *ListShareSnapshotsOptions) (result *ShareSnapshotCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listShareSnapshotsOptions, "listShareSnapshotsOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listShareSnapshotsOptions, "listShareSnapshotsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"share_id": *listShareSnapshotsOptions.ShareID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/snapshots`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareSnapshots")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listShareSnapshotsOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listShareSnapshotsOptions.BackupPolicyPlanID != nil {
builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listShareSnapshotsOptions.BackupPolicyPlanID))
}
if listShareSnapshotsOptions.Name != nil {
builder.AddQuery("name", fmt.Sprint(*listShareSnapshotsOptions.Name))
}
if listShareSnapshotsOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listShareSnapshotsOptions.Start))
}
if listShareSnapshotsOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listShareSnapshotsOptions.Limit))
}
if listShareSnapshotsOptions.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listShareSnapshotsOptions.Sort))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_share_snapshots", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareSnapshotCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateShareSnapshot : Create a snapshot for a file share
// This request creates a new share snapshot from a share snapshot prototype object. The prototype object is structured
// in the same way as a retrieved share snapshot, and contains the information necessary to create the new share
// snapshot.
//
// The share must have an `access_control_mode` of `security_group` and a `replication_role` of `source` or `none`.
//
// The snapshot will inherit its `resource_group` and encryption settings from the share.
//
// If the share has a `replication_role` of `source`, a corresponding snapshot on the replica share will be created with
// a `status` of `pending`. It will remain in
// `pending` until the data is synchronized per the replication schedule determined by the replica share's
// `replication_cron_spec`.
func (vpc *VpcV1) CreateShareSnapshot(createShareSnapshotOptions *CreateShareSnapshotOptions) (result *ShareSnapshot, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateShareSnapshotWithContext(context.Background(), createShareSnapshotOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreateShareSnapshotWithContext is an alternate form of the CreateShareSnapshot method which supports a Context parameter
func (vpc *VpcV1) CreateShareSnapshotWithContext(ctx context.Context, createShareSnapshotOptions *CreateShareSnapshotOptions) (result *ShareSnapshot, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createShareSnapshotOptions, "createShareSnapshotOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createShareSnapshotOptions, "createShareSnapshotOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"share_id": *createShareSnapshotOptions.ShareID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/snapshots`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareSnapshot")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createShareSnapshotOptions.Headers {
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 createShareSnapshotOptions.Name != nil {
body["name"] = createShareSnapshotOptions.Name
}
if createShareSnapshotOptions.UserTags != nil {
body["user_tags"] = createShareSnapshotOptions.UserTags
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_share_snapshot", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareSnapshot)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteShareSnapshot : Delete a share snapshot
// This request deletes a share snapshot. This operation cannot be reversed. For this request to succeed, the share must
// have a `replication_role` of `source` or `none`.
//
// If the request is accepted, the share snapshot `lifecycle_state` will be set to
// `deleting`. Once deletion processing completes, the share snapshot will no longer be retrievable.
//
// Deleting a share snapshot will not affect any previously-accepted requests to create a share from it.
//
// If the share has a `replication_role` of `source`, the corresponding snapshot on the replica share will be
// subsequently moved to a `lifecycle_state` of `deleting`. If the data for the corresponding snapshot has already been
// synchronized via the replication schedule determined by `replication_cron_spec`, the snapshot will remain available
// in the replica share's `.snapshot` directory until the next replication sync.
func (vpc *VpcV1) DeleteShareSnapshot(deleteShareSnapshotOptions *DeleteShareSnapshotOptions) (result *ShareSnapshot, response *core.DetailedResponse, err error) {
result, response, err = vpc.DeleteShareSnapshotWithContext(context.Background(), deleteShareSnapshotOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteShareSnapshotWithContext is an alternate form of the DeleteShareSnapshot method which supports a Context parameter
func (vpc *VpcV1) DeleteShareSnapshotWithContext(ctx context.Context, deleteShareSnapshotOptions *DeleteShareSnapshotOptions) (result *ShareSnapshot, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteShareSnapshotOptions, "deleteShareSnapshotOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteShareSnapshotOptions, "deleteShareSnapshotOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"share_id": *deleteShareSnapshotOptions.ShareID,
"id": *deleteShareSnapshotOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/snapshots/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSnapshot")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteShareSnapshotOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "delete_share_snapshot", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareSnapshot)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetShareSnapshot : Retrieve a share snapshot
// This request retrieves a single share snapshot specified by the identifier in the URL.
func (vpc *VpcV1) GetShareSnapshot(getShareSnapshotOptions *GetShareSnapshotOptions) (result *ShareSnapshot, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetShareSnapshotWithContext(context.Background(), getShareSnapshotOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetShareSnapshotWithContext is an alternate form of the GetShareSnapshot method which supports a Context parameter
func (vpc *VpcV1) GetShareSnapshotWithContext(ctx context.Context, getShareSnapshotOptions *GetShareSnapshotOptions) (result *ShareSnapshot, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getShareSnapshotOptions, "getShareSnapshotOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getShareSnapshotOptions, "getShareSnapshotOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"share_id": *getShareSnapshotOptions.ShareID,
"id": *getShareSnapshotOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/snapshots/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSnapshot")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getShareSnapshotOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_share_snapshot", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareSnapshot)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateShareSnapshot : Update a share snapshot
// This request updates a share snapshot with the information provided in a share snapshot patch object. The share
// snapshot patch object is structured in the same way as a retrieved share snapshot and needs to contain only the
// information to be updated.
func (vpc *VpcV1) UpdateShareSnapshot(updateShareSnapshotOptions *UpdateShareSnapshotOptions) (result *ShareSnapshot, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateShareSnapshotWithContext(context.Background(), updateShareSnapshotOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdateShareSnapshotWithContext is an alternate form of the UpdateShareSnapshot method which supports a Context parameter
func (vpc *VpcV1) UpdateShareSnapshotWithContext(ctx context.Context, updateShareSnapshotOptions *UpdateShareSnapshotOptions) (result *ShareSnapshot, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updateShareSnapshotOptions, "updateShareSnapshotOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateShareSnapshotOptions, "updateShareSnapshotOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"share_id": *updateShareSnapshotOptions.ShareID,
"id": *updateShareSnapshotOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/snapshots/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareSnapshot")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateShareSnapshotOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddHeader("Content-Type", "application/merge-patch+json")
if updateShareSnapshotOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*updateShareSnapshotOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
_, err = builder.SetBodyContentJSON(updateShareSnapshotOptions.ShareSnapshotPatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_share_snapshot", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareSnapshot)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteShareSource : Split the source file share from a replica file share
// This request removes the replication relationship between a source share and the replica share specified by the
// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a
// `lifecycle_state` of `updating`, or has a replication operation in progress.
//
// This operation cannot be reversed.
func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter
func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"share_id": *deleteShareSourceOptions.ShareID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteShareSourceOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_share_source", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// GetShareSource : Retrieve the source file share for a replica file share
// This request retrieves the source file share associated with the replica file share specified by the identifier in
// the URL.
func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter
func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"share_id": *getShareSourceOptions.ShareID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getShareSourceOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_share_source", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareReference)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListBackupPolicies : List backup policies
// This request lists backup policies in the region. Backup policies control which sources are selected for backup and
// include a set of backup policy plans that provide the backup schedules and deletion triggers.
func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter
func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) {
err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listBackupPoliciesOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listBackupPoliciesOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start))
}
if listBackupPoliciesOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit))
}
if listBackupPoliciesOptions.ResourceGroupID != nil {
builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID))
}
if listBackupPoliciesOptions.Name != nil {
builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name))
}
if listBackupPoliciesOptions.Tag != nil {
builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_backup_policies", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateBackupPolicy : Create a backup policy
// This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in
// the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy.
func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter
func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createBackupPolicyOptions.Headers {
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(createBackupPolicyOptions.BackupPolicyPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_backup_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListBackupPolicyJobs : List jobs for a backup policy
// This request retrieves jobs for a backup policy. A backup job represents the execution of a backup policy plan for a
// resource matching the policy's criteria.
func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter
func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listBackupPolicyJobsOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listBackupPolicyJobsOptions.Status != nil {
builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status))
}
if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil {
builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID))
}
if listBackupPolicyJobsOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start))
}
if listBackupPolicyJobsOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit))
}
if listBackupPolicyJobsOptions.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort))
}
if listBackupPolicyJobsOptions.SourceID != nil {
builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID))
}
if listBackupPolicyJobsOptions.TargetSnapshotsID != nil {
builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID))
}
if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil {
builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_backup_policy_jobs", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetBackupPolicyJob : Retrieve a backup policy job
// This request retrieves a single backup policy job specified by the identifier in the URL.
func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter
func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID,
"id": *getBackupPolicyJobOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getBackupPolicyJobOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_backup_policy_job", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListBackupPolicyPlans : List plans for a backup policy
// This request retrieves plans for a backup policy. Backup plans provide the backup schedule and deletion triggers.
func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter
func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listBackupPolicyPlansOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listBackupPolicyPlansOptions.Name != nil {
builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_backup_policy_plans", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateBackupPolicyPlan : Create a plan for a backup policy
// This request creates a new backup policy plan from a backup policy plan prototype object. The prototype object is
// structured in the same way as a retrieved backup policy plan, and contains the information necessary to create the
// new backup policy plan.
//
// Backups created by this plan will use the resource group of the source being backed up.
//
// Backups created by this plan will use the plan's name truncated to 46 characters, followed by a unique 16-character
// suffix.
func (vpc *VpcV1) CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateBackupPolicyPlanWithContext(context.Background(), createBackupPolicyPlanOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreateBackupPolicyPlanWithContext is an alternate form of the CreateBackupPolicyPlan method which supports a Context parameter
func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"backup_policy_id": *createBackupPolicyPlanOptions.BackupPolicyID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicyPlan")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createBackupPolicyPlanOptions.Headers {
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 createBackupPolicyPlanOptions.CronSpec != nil {
body["cron_spec"] = createBackupPolicyPlanOptions.CronSpec
}
if createBackupPolicyPlanOptions.Active != nil {
body["active"] = createBackupPolicyPlanOptions.Active
}
if createBackupPolicyPlanOptions.AttachUserTags != nil {
body["attach_user_tags"] = createBackupPolicyPlanOptions.AttachUserTags
}
if createBackupPolicyPlanOptions.ClonePolicy != nil {
body["clone_policy"] = createBackupPolicyPlanOptions.ClonePolicy
}
if createBackupPolicyPlanOptions.CopyUserTags != nil {
body["copy_user_tags"] = createBackupPolicyPlanOptions.CopyUserTags
}
if createBackupPolicyPlanOptions.DeletionTrigger != nil {
body["deletion_trigger"] = createBackupPolicyPlanOptions.DeletionTrigger
}
if createBackupPolicyPlanOptions.Name != nil {
body["name"] = createBackupPolicyPlanOptions.Name
}
if createBackupPolicyPlanOptions.RemoteRegionPolicies != nil {
body["remote_region_policies"] = createBackupPolicyPlanOptions.RemoteRegionPolicies
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_backup_policy_plan", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteBackupPolicyPlan : Delete a backup policy plan
// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by
// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with
// the plan will run to completion before the plan is deleted.
//
// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing
// completes, the backup policy plan will no longer be retrievable.
func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) {
result, response, err = vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter
func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID,
"id": *deleteBackupPolicyPlanOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
if deleteBackupPolicyPlanOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "delete_backup_policy_plan", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetBackupPolicyPlan : Retrieve a backup policy plan
// This request retrieves a single backup policy plan specified by the identifier in the URL.
func (vpc *VpcV1) GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetBackupPolicyPlanWithContext is an alternate form of the GetBackupPolicyPlan method which supports a Context parameter
func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"backup_policy_id": *getBackupPolicyPlanOptions.BackupPolicyID,
"id": *getBackupPolicyPlanOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getBackupPolicyPlanOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_backup_policy_plan", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateBackupPolicyPlan : Update a backup policy plan
// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is
// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated.
func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter
func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID,
"id": *updateBackupPolicyPlanOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddHeader("Content-Type", "application/merge-patch+json")
if updateBackupPolicyPlanOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyPlanOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
_, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_backup_policy_plan", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteBackupPolicy : Delete a backup policy
// This request deletes a backup policy. This operation cannot be reversed.
//
// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes,
// the backup policy will no longer be retrievable.
func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) {
result, response, err = vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter
func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *deleteBackupPolicyOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteBackupPolicyOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
if deleteBackupPolicyOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "delete_backup_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetBackupPolicy : Retrieve a backup policy
// This request retrieves a single backup policy specified by the identifier in the URL.
func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter
func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *getBackupPolicyOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getBackupPolicyOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_backup_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateBackupPolicy : Update a backup policy
// This request updates a backup policy with the information in a provided backup policy patch. The backup policy patch
// object is structured in the same way as a retrieved backup policy and contains only the information to be updated.
func (vpc *VpcV1) UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateBackupPolicyWithContext(context.Background(), updateBackupPolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdateBackupPolicyWithContext is an alternate form of the UpdateBackupPolicy method which supports a Context parameter
func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updateBackupPolicyOptions, "updateBackupPolicyOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateBackupPolicyOptions, "updateBackupPolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *updateBackupPolicyOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateBackupPolicyOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddHeader("Content-Type", "application/merge-patch+json")
if updateBackupPolicyOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
_, err = builder.SetBodyContentJSON(updateBackupPolicyOptions.BackupPolicyPatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_backup_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListRegions : List regions
// This request lists 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) {
result, response, err = vpc.ListRegionsWithContext(context.Background(), listRegionsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listRegionsOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_regions", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegionCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.GetRegionWithContext(context.Background(), getRegionOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getRegionOptions, "getRegionOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegion")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getRegionOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_region", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegion)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListRegionZones : List zones in a region
// This request lists 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) {
result, response, err = vpc.ListRegionZonesWithContext(context.Background(), listRegionZonesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listRegionZonesOptions, "listRegionZonesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegionZones")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listRegionZonesOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_region_zones", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZoneCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.GetRegionZoneWithContext(context.Background(), getRegionZoneOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getRegionZoneOptions, "getRegionZoneOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegionZone")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getRegionZoneOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_region_zone", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZone)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListVirtualNetworkInterfaces : List virtual network interfaces
// This request lists virtual network interfaces in the region. A virtual network interface is a logical abstraction of
// a virtual network interface in a subnet, and may be attached to a target resource.
//
// The virtual network interfaces will be sorted by their `created_at` property values, with newest virtual network
// interfaces first. Virtual network interfaces with identical
// `created_at` property values will in turn be sorted by ascending `name` property values.
func (vpc *VpcV1) ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListVirtualNetworkInterfacesWithContext(context.Background(), listVirtualNetworkInterfacesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListVirtualNetworkInterfacesWithContext is an alternate form of the ListVirtualNetworkInterfaces method which supports a Context parameter
func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) {
err = core.ValidateStruct(listVirtualNetworkInterfacesOptions, "listVirtualNetworkInterfacesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaces")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listVirtualNetworkInterfacesOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listVirtualNetworkInterfacesOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Start))
}
if listVirtualNetworkInterfacesOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Limit))
}
if listVirtualNetworkInterfacesOptions.ResourceGroupID != nil {
builder.AddQuery("resource_group.id", fmt.Sprint(*listVirtualNetworkInterfacesOptions.ResourceGroupID))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_virtual_network_interfaces", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterfaceCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateVirtualNetworkInterface : Create a virtual network interface
// This request creates a new virtual network interface from a virtual network interface prototype object. The prototype
// object is structured in the same way as a retrieved virtual network interface, and contains the information necessary
// to create the new virtual network interface.
func (vpc *VpcV1) CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateVirtualNetworkInterfaceWithContext(context.Background(), createVirtualNetworkInterfaceOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreateVirtualNetworkInterfaceWithContext is an alternate form of the CreateVirtualNetworkInterface method which supports a Context parameter
func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVirtualNetworkInterface")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createVirtualNetworkInterfaceOptions.Headers {
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 createVirtualNetworkInterfaceOptions.AllowIPSpoofing != nil {
body["allow_ip_spoofing"] = createVirtualNetworkInterfaceOptions.AllowIPSpoofing
}
if createVirtualNetworkInterfaceOptions.AutoDelete != nil {
body["auto_delete"] = createVirtualNetworkInterfaceOptions.AutoDelete
}
if createVirtualNetworkInterfaceOptions.EnableInfrastructureNat != nil {
body["enable_infrastructure_nat"] = createVirtualNetworkInterfaceOptions.EnableInfrastructureNat
}
if createVirtualNetworkInterfaceOptions.Ips != nil {
body["ips"] = createVirtualNetworkInterfaceOptions.Ips
}
if createVirtualNetworkInterfaceOptions.Name != nil {
body["name"] = createVirtualNetworkInterfaceOptions.Name
}
if createVirtualNetworkInterfaceOptions.PrimaryIP != nil {
body["primary_ip"] = createVirtualNetworkInterfaceOptions.PrimaryIP
}
if createVirtualNetworkInterfaceOptions.ProtocolStateFilteringMode != nil {
body["protocol_state_filtering_mode"] = createVirtualNetworkInterfaceOptions.ProtocolStateFilteringMode
}
if createVirtualNetworkInterfaceOptions.ResourceGroup != nil {
body["resource_group"] = createVirtualNetworkInterfaceOptions.ResourceGroup
}
if createVirtualNetworkInterfaceOptions.SecurityGroups != nil {
body["security_groups"] = createVirtualNetworkInterfaceOptions.SecurityGroups
}
if createVirtualNetworkInterfaceOptions.Subnet != nil {
body["subnet"] = createVirtualNetworkInterfaceOptions.Subnet
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_virtual_network_interface", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteVirtualNetworkInterfaces : Delete a virtual network interface
// This request deletes a virtual network interface. This operation cannot be reversed. For this request to succeed, the
// virtual network interface must not be required by another resource, such as the primary network attachment for an
// instance.
func (vpc *VpcV1) DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) {
result, response, err = vpc.DeleteVirtualNetworkInterfacesWithContext(context.Background(), deleteVirtualNetworkInterfacesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteVirtualNetworkInterfacesWithContext is an alternate form of the DeleteVirtualNetworkInterfaces method which supports a Context parameter
func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *deleteVirtualNetworkInterfacesOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVirtualNetworkInterfaces")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteVirtualNetworkInterfacesOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "delete_virtual_network_interfaces", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetVirtualNetworkInterface : Retrieve a virtual network interface
// This request retrieves a single virtual network interface specified by the identifier in the URL.
func (vpc *VpcV1) GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetVirtualNetworkInterfaceWithContext(context.Background(), getVirtualNetworkInterfaceOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetVirtualNetworkInterfaceWithContext is an alternate form of the GetVirtualNetworkInterface method which supports a Context parameter
func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *getVirtualNetworkInterfaceOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterface")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getVirtualNetworkInterfaceOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_virtual_network_interface", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateVirtualNetworkInterface : Update a virtual network interface
// This request updates a virtual network interface with the information in a provided virtual network interface patch.
// The virtual network interface patch object is structured in the same way as a retrieved virtual network interface and
// contains only the information to be updated.
func (vpc *VpcV1) UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateVirtualNetworkInterfaceWithContext(context.Background(), updateVirtualNetworkInterfaceOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdateVirtualNetworkInterfaceWithContext is an alternate form of the UpdateVirtualNetworkInterface method which supports a Context parameter
func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *updateVirtualNetworkInterfaceOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVirtualNetworkInterface")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateVirtualNetworkInterfaceOptions.Headers {
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(updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_virtual_network_interface", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListNetworkInterfaceFloatingIps : List floating IPs associated with a virtual network interface
// This request lists floating IPs associated with a virtual network interface.
func (vpc *VpcV1) ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListNetworkInterfaceFloatingIpsWithContext(context.Background(), listNetworkInterfaceFloatingIpsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListNetworkInterfaceFloatingIps method which supports a Context parameter
func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"virtual_network_interface_id": *listNetworkInterfaceFloatingIpsOptions.VirtualNetworkInterfaceID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkInterfaceFloatingIps")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listNetworkInterfaceFloatingIpsOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listNetworkInterfaceFloatingIpsOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Start))
}
if listNetworkInterfaceFloatingIpsOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Limit))
}
if listNetworkInterfaceFloatingIpsOptions.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Sort))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_network_interface_floating_ips", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// RemoveNetworkInterfaceFloatingIP : Disassociate a floating IP from a virtual network interface
// This request disassociates the specified floating IP from the specified virtual network interface.
func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.RemoveNetworkInterfaceFloatingIPWithContext(context.Background(), removeNetworkInterfaceFloatingIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// RemoveNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveNetworkInterfaceFloatingIP method which supports a Context parameter
func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"virtual_network_interface_id": *removeNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID,
"id": *removeNetworkInterfaceFloatingIPOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveNetworkInterfaceFloatingIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range removeNetworkInterfaceFloatingIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "remove_network_interface_floating_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// GetNetworkInterfaceFloatingIP : Retrieve associated floating IP
// This request retrieves a specified floating IP if it is associated with the virtual network interface specified in
// the URL.
func (vpc *VpcV1) GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetNetworkInterfaceFloatingIPWithContext(context.Background(), getNetworkInterfaceFloatingIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetNetworkInterfaceFloatingIPWithContext is an alternate form of the GetNetworkInterfaceFloatingIP method which supports a Context parameter
func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"virtual_network_interface_id": *getNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID,
"id": *getNetworkInterfaceFloatingIPOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkInterfaceFloatingIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getNetworkInterfaceFloatingIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_network_interface_floating_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// AddNetworkInterfaceFloatingIP : Add an association between a floating IP and a virtual network interface
// This request adds an association between the specified floating IP and the specified virtual network interface.
//
// If the virtual network interface has `enable_infrastructure_nat` set to `true`, no more than one floating IP can be
// associated, and network address translation is performed between the floating IP address and the virtual network
// interface's `primary_ip` address.
//
// If the virtual network interface has `enable_infrastructure_nat` set to `false`, packets are passed unchanged to/from
// the virtual network interface.
//
// The floating IP must:
// - be in the same `zone` as the virtual network interface
// - not currently be associated with another resource
//
// The virtual network interface's `target` must not currently be a file share mount target.
//
// A request body is not required, and if provided, is ignored.
func (vpc *VpcV1) AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) {
result, response, err = vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// AddNetworkInterfaceFloatingIPWithContext is an alternate form of the AddNetworkInterfaceFloatingIP method which supports a Context parameter
func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"virtual_network_interface_id": *addNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID,
"id": *addNetworkInterfaceFloatingIPOptions.ID,
}
builder := core.NewRequestBuilder(core.PUT)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddNetworkInterfaceFloatingIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range addNetworkInterfaceFloatingIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "add_network_interface_floating_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListVirtualNetworkInterfaceIps : List reserved IPs bound to a virtual network interface
// This request lists reserved IPs bound to a virtual network interface.
func (vpc *VpcV1) ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListVirtualNetworkInterfaceIpsWithContext(context.Background(), listVirtualNetworkInterfaceIpsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListVirtualNetworkInterfaceIpsWithContext is an alternate form of the ListVirtualNetworkInterfaceIps method which supports a Context parameter
func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"virtual_network_interface_id": *listVirtualNetworkInterfaceIpsOptions.VirtualNetworkInterfaceID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaceIps")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listVirtualNetworkInterfaceIpsOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listVirtualNetworkInterfaceIpsOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Start))
}
if listVirtualNetworkInterfaceIpsOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Limit))
}
if listVirtualNetworkInterfaceIpsOptions.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Sort))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_virtual_network_interface_ips", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// RemoveVirtualNetworkInterfaceIP : Unbind a reserved IP from a virtual network interface
// This request unbinds the specified reserved IP from the specified virtual network interface. If the reserved IP has
// `auto_delete` set to `true`, the reserved IP will be deleted.
//
// The reserved IP for the `primary_ip` cannot be unbound.
func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.RemoveVirtualNetworkInterfaceIPWithContext(context.Background(), removeVirtualNetworkInterfaceIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// RemoveVirtualNetworkInterfaceIPWithContext is an alternate form of the RemoveVirtualNetworkInterfaceIP method which supports a Context parameter
func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context, removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"virtual_network_interface_id": *removeVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID,
"id": *removeVirtualNetworkInterfaceIPOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVirtualNetworkInterfaceIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range removeVirtualNetworkInterfaceIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "remove_virtual_network_interface_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// GetVirtualNetworkInterfaceIP : Retrieve bound reserved IP
// This request retrieves the specified reserved IP address if it is bound to the virtual network interface specified in
// the URL.
func (vpc *VpcV1) GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetVirtualNetworkInterfaceIPWithContext is an alternate form of the GetVirtualNetworkInterfaceIP method which supports a Context parameter
func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"virtual_network_interface_id": *getVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID,
"id": *getVirtualNetworkInterfaceIPOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterfaceIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getVirtualNetworkInterfaceIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_virtual_network_interface_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// AddVirtualNetworkInterfaceIP : Bind a reserved IP to a virtual network interface
// This request binds the specified reserved IP to the specified virtual network interface.
//
// The reserved IP must currently be unbound and in the primary IP's subnet. The virtual network interface's `target`
// must not currently be a file share mount target.
func (vpc *VpcV1) AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) {
result, response, err = vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// AddVirtualNetworkInterfaceIPWithContext is an alternate form of the AddVirtualNetworkInterfaceIP method which supports a Context parameter
func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"virtual_network_interface_id": *addVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID,
"id": *addVirtualNetworkInterfaceIPOptions.ID,
}
builder := core.NewRequestBuilder(core.PUT)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVirtualNetworkInterfaceIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range addVirtualNetworkInterfaceIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "add_virtual_network_interface_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListClusterNetworkProfiles : List cluster network profiles
// This request lists cluster network profiles available in the region. A cluster network profile specifies the
// performance characteristics and capabilities for a cluster network.
func (vpc *VpcV1) ListClusterNetworkProfiles(listClusterNetworkProfilesOptions *ListClusterNetworkProfilesOptions) (result *ClusterNetworkProfileCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListClusterNetworkProfilesWithContext(context.Background(), listClusterNetworkProfilesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListClusterNetworkProfilesWithContext is an alternate form of the ListClusterNetworkProfiles method which supports a Context parameter
func (vpc *VpcV1) ListClusterNetworkProfilesWithContext(ctx context.Context, listClusterNetworkProfilesOptions *ListClusterNetworkProfilesOptions) (result *ClusterNetworkProfileCollection, response *core.DetailedResponse, err error) {
err = core.ValidateStruct(listClusterNetworkProfilesOptions, "listClusterNetworkProfilesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_network/profiles`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkProfiles")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listClusterNetworkProfilesOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listClusterNetworkProfilesOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listClusterNetworkProfilesOptions.Start))
}
if listClusterNetworkProfilesOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listClusterNetworkProfilesOptions.Limit))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_cluster_network_profiles", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkProfileCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetClusterNetworkProfile : Retrieve a cluster network profile
// This request retrieves a single cluster network profile specified by the name in the URL.
func (vpc *VpcV1) GetClusterNetworkProfile(getClusterNetworkProfileOptions *GetClusterNetworkProfileOptions) (result *ClusterNetworkProfile, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetClusterNetworkProfileWithContext(context.Background(), getClusterNetworkProfileOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetClusterNetworkProfileWithContext is an alternate form of the GetClusterNetworkProfile method which supports a Context parameter
func (vpc *VpcV1) GetClusterNetworkProfileWithContext(ctx context.Context, getClusterNetworkProfileOptions *GetClusterNetworkProfileOptions) (result *ClusterNetworkProfile, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getClusterNetworkProfileOptions, "getClusterNetworkProfileOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getClusterNetworkProfileOptions, "getClusterNetworkProfileOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"name": *getClusterNetworkProfileOptions.Name,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_network/profiles/{name}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkProfile")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getClusterNetworkProfileOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_cluster_network_profile", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkProfile)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListClusterNetworks : List cluster networks
// This request lists [cluster networks](https://cloud.ibm.com/docs/vpc?topic=vpc-about-cluster-network) in the region.
// A cluster network is a grouping of resources in a separate networking space for high performance computing and
// networking.
func (vpc *VpcV1) ListClusterNetworks(listClusterNetworksOptions *ListClusterNetworksOptions) (result *ClusterNetworkCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListClusterNetworksWithContext(context.Background(), listClusterNetworksOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListClusterNetworksWithContext is an alternate form of the ListClusterNetworks method which supports a Context parameter
func (vpc *VpcV1) ListClusterNetworksWithContext(ctx context.Context, listClusterNetworksOptions *ListClusterNetworksOptions) (result *ClusterNetworkCollection, response *core.DetailedResponse, err error) {
err = core.ValidateStruct(listClusterNetworksOptions, "listClusterNetworksOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworks")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listClusterNetworksOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listClusterNetworksOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listClusterNetworksOptions.Start))
}
if listClusterNetworksOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listClusterNetworksOptions.Limit))
}
if listClusterNetworksOptions.ResourceGroupID != nil {
builder.AddQuery("resource_group.id", fmt.Sprint(*listClusterNetworksOptions.ResourceGroupID))
}
if listClusterNetworksOptions.Name != nil {
builder.AddQuery("name", fmt.Sprint(*listClusterNetworksOptions.Name))
}
if listClusterNetworksOptions.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listClusterNetworksOptions.Sort))
}
if listClusterNetworksOptions.VPCID != nil {
builder.AddQuery("vpc.id", fmt.Sprint(*listClusterNetworksOptions.VPCID))
}
if listClusterNetworksOptions.VPCCRN != nil {
builder.AddQuery("vpc.crn", fmt.Sprint(*listClusterNetworksOptions.VPCCRN))
}
if listClusterNetworksOptions.VPCName != nil {
builder.AddQuery("vpc.name", fmt.Sprint(*listClusterNetworksOptions.VPCName))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_cluster_networks", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateClusterNetwork : Create a cluster network
// This request creates a new cluster network from a cluster network prototype object. The prototype object is
// structured in the same way as a retrieved cluster network, and contains the information necessary to create the new
// cluster network.
func (vpc *VpcV1) CreateClusterNetwork(createClusterNetworkOptions *CreateClusterNetworkOptions) (result *ClusterNetwork, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateClusterNetworkWithContext(context.Background(), createClusterNetworkOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreateClusterNetworkWithContext is an alternate form of the CreateClusterNetwork method which supports a Context parameter
func (vpc *VpcV1) CreateClusterNetworkWithContext(ctx context.Context, createClusterNetworkOptions *CreateClusterNetworkOptions) (result *ClusterNetwork, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createClusterNetworkOptions, "createClusterNetworkOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createClusterNetworkOptions, "createClusterNetworkOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetwork")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createClusterNetworkOptions.Headers {
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 createClusterNetworkOptions.Profile != nil {
body["profile"] = createClusterNetworkOptions.Profile
}
if createClusterNetworkOptions.VPC != nil {
body["vpc"] = createClusterNetworkOptions.VPC
}
if createClusterNetworkOptions.Zone != nil {
body["zone"] = createClusterNetworkOptions.Zone
}
if createClusterNetworkOptions.Name != nil {
body["name"] = createClusterNetworkOptions.Name
}
if createClusterNetworkOptions.ResourceGroup != nil {
body["resource_group"] = createClusterNetworkOptions.ResourceGroup
}
if createClusterNetworkOptions.SubnetPrefixes != nil {
body["subnet_prefixes"] = createClusterNetworkOptions.SubnetPrefixes
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_cluster_network", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetwork)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListClusterNetworkInterfaces : List cluster network interfaces
// This request lists cluster network interfaces in the region. A cluster network interface is a logical abstraction of
// a cluster network interface in a subnet, and may be attached to a target resource.
//
// The cluster network interfaces will be sorted by their `created_at` property values, with newest cluster network
// interfaces first. Cluster network interfaces with identical
// `created_at` property values will in turn be sorted by ascending `name` property values.
func (vpc *VpcV1) ListClusterNetworkInterfaces(listClusterNetworkInterfacesOptions *ListClusterNetworkInterfacesOptions) (result *ClusterNetworkInterfaceCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListClusterNetworkInterfacesWithContext(context.Background(), listClusterNetworkInterfacesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListClusterNetworkInterfacesWithContext is an alternate form of the ListClusterNetworkInterfaces method which supports a Context parameter
func (vpc *VpcV1) ListClusterNetworkInterfacesWithContext(ctx context.Context, listClusterNetworkInterfacesOptions *ListClusterNetworkInterfacesOptions) (result *ClusterNetworkInterfaceCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listClusterNetworkInterfacesOptions, "listClusterNetworkInterfacesOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listClusterNetworkInterfacesOptions, "listClusterNetworkInterfacesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"cluster_network_id": *listClusterNetworkInterfacesOptions.ClusterNetworkID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/interfaces`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkInterfaces")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listClusterNetworkInterfacesOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listClusterNetworkInterfacesOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listClusterNetworkInterfacesOptions.Start))
}
if listClusterNetworkInterfacesOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listClusterNetworkInterfacesOptions.Limit))
}
if listClusterNetworkInterfacesOptions.Name != nil {
builder.AddQuery("name", fmt.Sprint(*listClusterNetworkInterfacesOptions.Name))
}
if listClusterNetworkInterfacesOptions.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listClusterNetworkInterfacesOptions.Sort))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_cluster_network_interfaces", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkInterfaceCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateClusterNetworkInterface : Create a cluster network interface
// This request creates a new cluster network interface from a cluster network interface prototype object. The prototype
// object is structured in the same way as a retrieved cluster network interface, and contains the information necessary
// to create the new cluster network interface.
func (vpc *VpcV1) CreateClusterNetworkInterface(createClusterNetworkInterfaceOptions *CreateClusterNetworkInterfaceOptions) (result *ClusterNetworkInterface, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateClusterNetworkInterfaceWithContext(context.Background(), createClusterNetworkInterfaceOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreateClusterNetworkInterfaceWithContext is an alternate form of the CreateClusterNetworkInterface method which supports a Context parameter
func (vpc *VpcV1) CreateClusterNetworkInterfaceWithContext(ctx context.Context, createClusterNetworkInterfaceOptions *CreateClusterNetworkInterfaceOptions) (result *ClusterNetworkInterface, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createClusterNetworkInterfaceOptions, "createClusterNetworkInterfaceOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createClusterNetworkInterfaceOptions, "createClusterNetworkInterfaceOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"cluster_network_id": *createClusterNetworkInterfaceOptions.ClusterNetworkID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/interfaces`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkInterface")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createClusterNetworkInterfaceOptions.Headers {
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 createClusterNetworkInterfaceOptions.Name != nil {
body["name"] = createClusterNetworkInterfaceOptions.Name
}
if createClusterNetworkInterfaceOptions.PrimaryIP != nil {
body["primary_ip"] = createClusterNetworkInterfaceOptions.PrimaryIP
}
if createClusterNetworkInterfaceOptions.Subnet != nil {
body["subnet"] = createClusterNetworkInterfaceOptions.Subnet
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_cluster_network_interface", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkInterface)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteClusterNetworkInterface : Delete a cluster network interface
// This request deletes a cluster network interface. This operation cannot be reversed. For this request to succeed,
// the cluster network interface must not be required by another resource, such as a cluster network attachment for a
// virtual server instance.
func (vpc *VpcV1) DeleteClusterNetworkInterface(deleteClusterNetworkInterfaceOptions *DeleteClusterNetworkInterfaceOptions) (result *ClusterNetworkInterface, response *core.DetailedResponse, err error) {
result, response, err = vpc.DeleteClusterNetworkInterfaceWithContext(context.Background(), deleteClusterNetworkInterfaceOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteClusterNetworkInterfaceWithContext is an alternate form of the DeleteClusterNetworkInterface method which supports a Context parameter
func (vpc *VpcV1) DeleteClusterNetworkInterfaceWithContext(ctx context.Context, deleteClusterNetworkInterfaceOptions *DeleteClusterNetworkInterfaceOptions) (result *ClusterNetworkInterface, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteClusterNetworkInterfaceOptions, "deleteClusterNetworkInterfaceOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteClusterNetworkInterfaceOptions, "deleteClusterNetworkInterfaceOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"cluster_network_id": *deleteClusterNetworkInterfaceOptions.ClusterNetworkID,
"id": *deleteClusterNetworkInterfaceOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/interfaces/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetworkInterface")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteClusterNetworkInterfaceOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
if deleteClusterNetworkInterfaceOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*deleteClusterNetworkInterfaceOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "delete_cluster_network_interface", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkInterface)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetClusterNetworkInterface : Retrieve a cluster network interface
// This request retrieves a single cluster network interface specified by the identifier in the URL.
func (vpc *VpcV1) GetClusterNetworkInterface(getClusterNetworkInterfaceOptions *GetClusterNetworkInterfaceOptions) (result *ClusterNetworkInterface, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetClusterNetworkInterfaceWithContext(context.Background(), getClusterNetworkInterfaceOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetClusterNetworkInterfaceWithContext is an alternate form of the GetClusterNetworkInterface method which supports a Context parameter
func (vpc *VpcV1) GetClusterNetworkInterfaceWithContext(ctx context.Context, getClusterNetworkInterfaceOptions *GetClusterNetworkInterfaceOptions) (result *ClusterNetworkInterface, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getClusterNetworkInterfaceOptions, "getClusterNetworkInterfaceOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getClusterNetworkInterfaceOptions, "getClusterNetworkInterfaceOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"cluster_network_id": *getClusterNetworkInterfaceOptions.ClusterNetworkID,
"id": *getClusterNetworkInterfaceOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/interfaces/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkInterface")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getClusterNetworkInterfaceOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_cluster_network_interface", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkInterface)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateClusterNetworkInterface : Update a cluster network interface
// This request updates a cluster network interface with the information provided in a cluster network interface patch
// object. The patch object is structured in the same way as a retrieved cluster network interface and needs to contain
// only the information to be updated.
func (vpc *VpcV1) UpdateClusterNetworkInterface(updateClusterNetworkInterfaceOptions *UpdateClusterNetworkInterfaceOptions) (result *ClusterNetworkInterface, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateClusterNetworkInterfaceWithContext(context.Background(), updateClusterNetworkInterfaceOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdateClusterNetworkInterfaceWithContext is an alternate form of the UpdateClusterNetworkInterface method which supports a Context parameter
func (vpc *VpcV1) UpdateClusterNetworkInterfaceWithContext(ctx context.Context, updateClusterNetworkInterfaceOptions *UpdateClusterNetworkInterfaceOptions) (result *ClusterNetworkInterface, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updateClusterNetworkInterfaceOptions, "updateClusterNetworkInterfaceOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateClusterNetworkInterfaceOptions, "updateClusterNetworkInterfaceOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"cluster_network_id": *updateClusterNetworkInterfaceOptions.ClusterNetworkID,
"id": *updateClusterNetworkInterfaceOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/interfaces/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetworkInterface")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateClusterNetworkInterfaceOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddHeader("Content-Type", "application/merge-patch+json")
if updateClusterNetworkInterfaceOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*updateClusterNetworkInterfaceOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
_, err = builder.SetBodyContentJSON(updateClusterNetworkInterfaceOptions.ClusterNetworkInterfacePatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_cluster_network_interface", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkInterface)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListClusterNetworkSubnets : List cluster network subnets
// This request lists cluster network subnets in the cluster network. A cluster network subnet provides network routing
// between other cluster network subnets within a cluster network.
func (vpc *VpcV1) ListClusterNetworkSubnets(listClusterNetworkSubnetsOptions *ListClusterNetworkSubnetsOptions) (result *ClusterNetworkSubnetCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListClusterNetworkSubnetsWithContext(context.Background(), listClusterNetworkSubnetsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListClusterNetworkSubnetsWithContext is an alternate form of the ListClusterNetworkSubnets method which supports a Context parameter
func (vpc *VpcV1) ListClusterNetworkSubnetsWithContext(ctx context.Context, listClusterNetworkSubnetsOptions *ListClusterNetworkSubnetsOptions) (result *ClusterNetworkSubnetCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listClusterNetworkSubnetsOptions, "listClusterNetworkSubnetsOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listClusterNetworkSubnetsOptions, "listClusterNetworkSubnetsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"cluster_network_id": *listClusterNetworkSubnetsOptions.ClusterNetworkID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkSubnets")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listClusterNetworkSubnetsOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listClusterNetworkSubnetsOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listClusterNetworkSubnetsOptions.Start))
}
if listClusterNetworkSubnetsOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listClusterNetworkSubnetsOptions.Limit))
}
if listClusterNetworkSubnetsOptions.Name != nil {
builder.AddQuery("name", fmt.Sprint(*listClusterNetworkSubnetsOptions.Name))
}
if listClusterNetworkSubnetsOptions.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listClusterNetworkSubnetsOptions.Sort))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_cluster_network_subnets", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnetCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateClusterNetworkSubnet : Create a cluster network subnet
// This request creates a new cluster network subnet from a cluster network subnet prototype object. The prototype
// object is structured in the same way as a retrieved cluster network subnet, and contains the information necessary to
// create the new cluster network subnet.
func (vpc *VpcV1) CreateClusterNetworkSubnet(createClusterNetworkSubnetOptions *CreateClusterNetworkSubnetOptions) (result *ClusterNetworkSubnet, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateClusterNetworkSubnetWithContext(context.Background(), createClusterNetworkSubnetOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreateClusterNetworkSubnetWithContext is an alternate form of the CreateClusterNetworkSubnet method which supports a Context parameter
func (vpc *VpcV1) CreateClusterNetworkSubnetWithContext(ctx context.Context, createClusterNetworkSubnetOptions *CreateClusterNetworkSubnetOptions) (result *ClusterNetworkSubnet, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createClusterNetworkSubnetOptions, "createClusterNetworkSubnetOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createClusterNetworkSubnetOptions, "createClusterNetworkSubnetOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"cluster_network_id": *createClusterNetworkSubnetOptions.ClusterNetworkID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkSubnet")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createClusterNetworkSubnetOptions.Headers {
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(createClusterNetworkSubnetOptions.ClusterNetworkSubnetPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_cluster_network_subnet", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnet)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListClusterNetworkSubnetReservedIps : List cluster network subnet reserved IPs
// This request lists cluster network subnet reserved IPs in the cluster network.
func (vpc *VpcV1) ListClusterNetworkSubnetReservedIps(listClusterNetworkSubnetReservedIpsOptions *ListClusterNetworkSubnetReservedIpsOptions) (result *ClusterNetworkSubnetReservedIPCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListClusterNetworkSubnetReservedIpsWithContext(context.Background(), listClusterNetworkSubnetReservedIpsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListClusterNetworkSubnetReservedIpsWithContext is an alternate form of the ListClusterNetworkSubnetReservedIps method which supports a Context parameter
func (vpc *VpcV1) ListClusterNetworkSubnetReservedIpsWithContext(ctx context.Context, listClusterNetworkSubnetReservedIpsOptions *ListClusterNetworkSubnetReservedIpsOptions) (result *ClusterNetworkSubnetReservedIPCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listClusterNetworkSubnetReservedIpsOptions, "listClusterNetworkSubnetReservedIpsOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listClusterNetworkSubnetReservedIpsOptions, "listClusterNetworkSubnetReservedIpsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"cluster_network_id": *listClusterNetworkSubnetReservedIpsOptions.ClusterNetworkID,
"cluster_network_subnet_id": *listClusterNetworkSubnetReservedIpsOptions.ClusterNetworkSubnetID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListClusterNetworkSubnetReservedIps")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listClusterNetworkSubnetReservedIpsOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listClusterNetworkSubnetReservedIpsOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Start))
}
if listClusterNetworkSubnetReservedIpsOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Limit))
}
if listClusterNetworkSubnetReservedIpsOptions.Name != nil {
builder.AddQuery("name", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Name))
}
if listClusterNetworkSubnetReservedIpsOptions.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listClusterNetworkSubnetReservedIpsOptions.Sort))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_cluster_network_subnet_reserved_ips", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnetReservedIPCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateClusterNetworkSubnetReservedIP : Create a cluster network subnet reserved IP
// This request creates a new cluster network subnet reserved IP from a cluster network subnet reserved IP prototype
// object. The prototype object is structured in the same way as a retrieved cluster network subnet reserved IP, and
// contains the information necessary to create the new cluster network subnet reserved IP.
func (vpc *VpcV1) CreateClusterNetworkSubnetReservedIP(createClusterNetworkSubnetReservedIPOptions *CreateClusterNetworkSubnetReservedIPOptions) (result *ClusterNetworkSubnetReservedIP, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateClusterNetworkSubnetReservedIPWithContext(context.Background(), createClusterNetworkSubnetReservedIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreateClusterNetworkSubnetReservedIPWithContext is an alternate form of the CreateClusterNetworkSubnetReservedIP method which supports a Context parameter
func (vpc *VpcV1) CreateClusterNetworkSubnetReservedIPWithContext(ctx context.Context, createClusterNetworkSubnetReservedIPOptions *CreateClusterNetworkSubnetReservedIPOptions) (result *ClusterNetworkSubnetReservedIP, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createClusterNetworkSubnetReservedIPOptions, "createClusterNetworkSubnetReservedIPOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createClusterNetworkSubnetReservedIPOptions, "createClusterNetworkSubnetReservedIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"cluster_network_id": *createClusterNetworkSubnetReservedIPOptions.ClusterNetworkID,
"cluster_network_subnet_id": *createClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateClusterNetworkSubnetReservedIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createClusterNetworkSubnetReservedIPOptions.Headers {
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 createClusterNetworkSubnetReservedIPOptions.Address != nil {
body["address"] = createClusterNetworkSubnetReservedIPOptions.Address
}
if createClusterNetworkSubnetReservedIPOptions.Name != nil {
body["name"] = createClusterNetworkSubnetReservedIPOptions.Name
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_cluster_network_subnet_reserved_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnetReservedIP)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteClusterNetworkSubnetReservedIP : Delete a cluster network subnet reserved IP
// This request deletes a cluster network subnet reserved IP. This operation cannot be reversed.
//
// For this request to succeed, the reserved IP must be unbound. A provider-owned reserved IP is not allowed to be
// deleted.
func (vpc *VpcV1) DeleteClusterNetworkSubnetReservedIP(deleteClusterNetworkSubnetReservedIPOptions *DeleteClusterNetworkSubnetReservedIPOptions) (result *ClusterNetworkSubnetReservedIP, response *core.DetailedResponse, err error) {
result, response, err = vpc.DeleteClusterNetworkSubnetReservedIPWithContext(context.Background(), deleteClusterNetworkSubnetReservedIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteClusterNetworkSubnetReservedIPWithContext is an alternate form of the DeleteClusterNetworkSubnetReservedIP method which supports a Context parameter
func (vpc *VpcV1) DeleteClusterNetworkSubnetReservedIPWithContext(ctx context.Context, deleteClusterNetworkSubnetReservedIPOptions *DeleteClusterNetworkSubnetReservedIPOptions) (result *ClusterNetworkSubnetReservedIP, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteClusterNetworkSubnetReservedIPOptions, "deleteClusterNetworkSubnetReservedIPOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteClusterNetworkSubnetReservedIPOptions, "deleteClusterNetworkSubnetReservedIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"cluster_network_id": *deleteClusterNetworkSubnetReservedIPOptions.ClusterNetworkID,
"cluster_network_subnet_id": *deleteClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetID,
"id": *deleteClusterNetworkSubnetReservedIPOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetworkSubnetReservedIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteClusterNetworkSubnetReservedIPOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
if deleteClusterNetworkSubnetReservedIPOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*deleteClusterNetworkSubnetReservedIPOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "delete_cluster_network_subnet_reserved_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnetReservedIP)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetClusterNetworkSubnetReservedIP : Retrieve a cluster network subnet reserved IP
// This request retrieves a single cluster network subnet reserved IP specified by the identifier in the URL.
func (vpc *VpcV1) GetClusterNetworkSubnetReservedIP(getClusterNetworkSubnetReservedIPOptions *GetClusterNetworkSubnetReservedIPOptions) (result *ClusterNetworkSubnetReservedIP, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetClusterNetworkSubnetReservedIPWithContext(context.Background(), getClusterNetworkSubnetReservedIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetClusterNetworkSubnetReservedIPWithContext is an alternate form of the GetClusterNetworkSubnetReservedIP method which supports a Context parameter
func (vpc *VpcV1) GetClusterNetworkSubnetReservedIPWithContext(ctx context.Context, getClusterNetworkSubnetReservedIPOptions *GetClusterNetworkSubnetReservedIPOptions) (result *ClusterNetworkSubnetReservedIP, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getClusterNetworkSubnetReservedIPOptions, "getClusterNetworkSubnetReservedIPOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getClusterNetworkSubnetReservedIPOptions, "getClusterNetworkSubnetReservedIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"cluster_network_id": *getClusterNetworkSubnetReservedIPOptions.ClusterNetworkID,
"cluster_network_subnet_id": *getClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetID,
"id": *getClusterNetworkSubnetReservedIPOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkSubnetReservedIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getClusterNetworkSubnetReservedIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_cluster_network_subnet_reserved_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnetReservedIP)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateClusterNetworkSubnetReservedIP : Update a cluster network subnet reserved IP
// This request updates a cluster network subnet reserved IP with the information provided in a cluster network subnet
// reserved IP patch object. The patch object is structured in the same way as a retrieved cluster network subnet
// reserved IP and needs to contain only the information to be updated.
func (vpc *VpcV1) UpdateClusterNetworkSubnetReservedIP(updateClusterNetworkSubnetReservedIPOptions *UpdateClusterNetworkSubnetReservedIPOptions) (result *ClusterNetworkSubnetReservedIP, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateClusterNetworkSubnetReservedIPWithContext(context.Background(), updateClusterNetworkSubnetReservedIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdateClusterNetworkSubnetReservedIPWithContext is an alternate form of the UpdateClusterNetworkSubnetReservedIP method which supports a Context parameter
func (vpc *VpcV1) UpdateClusterNetworkSubnetReservedIPWithContext(ctx context.Context, updateClusterNetworkSubnetReservedIPOptions *UpdateClusterNetworkSubnetReservedIPOptions) (result *ClusterNetworkSubnetReservedIP, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updateClusterNetworkSubnetReservedIPOptions, "updateClusterNetworkSubnetReservedIPOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateClusterNetworkSubnetReservedIPOptions, "updateClusterNetworkSubnetReservedIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"cluster_network_id": *updateClusterNetworkSubnetReservedIPOptions.ClusterNetworkID,
"cluster_network_subnet_id": *updateClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetID,
"id": *updateClusterNetworkSubnetReservedIPOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets/{cluster_network_subnet_id}/reserved_ips/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetworkSubnetReservedIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateClusterNetworkSubnetReservedIPOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddHeader("Content-Type", "application/merge-patch+json")
if updateClusterNetworkSubnetReservedIPOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*updateClusterNetworkSubnetReservedIPOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
_, err = builder.SetBodyContentJSON(updateClusterNetworkSubnetReservedIPOptions.ClusterNetworkSubnetReservedIPPatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_cluster_network_subnet_reserved_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnetReservedIP)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteClusterNetworkSubnet : Delete a cluster network subnet
// This request deletes a cluster network subnet. This operation cannot be reversed.
//
// For this request to succeed, this cluster subnet must not be attached to a cluster network interface.
func (vpc *VpcV1) DeleteClusterNetworkSubnet(deleteClusterNetworkSubnetOptions *DeleteClusterNetworkSubnetOptions) (result *ClusterNetworkSubnet, response *core.DetailedResponse, err error) {
result, response, err = vpc.DeleteClusterNetworkSubnetWithContext(context.Background(), deleteClusterNetworkSubnetOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteClusterNetworkSubnetWithContext is an alternate form of the DeleteClusterNetworkSubnet method which supports a Context parameter
func (vpc *VpcV1) DeleteClusterNetworkSubnetWithContext(ctx context.Context, deleteClusterNetworkSubnetOptions *DeleteClusterNetworkSubnetOptions) (result *ClusterNetworkSubnet, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteClusterNetworkSubnetOptions, "deleteClusterNetworkSubnetOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteClusterNetworkSubnetOptions, "deleteClusterNetworkSubnetOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"cluster_network_id": *deleteClusterNetworkSubnetOptions.ClusterNetworkID,
"id": *deleteClusterNetworkSubnetOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetworkSubnet")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteClusterNetworkSubnetOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
if deleteClusterNetworkSubnetOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*deleteClusterNetworkSubnetOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "delete_cluster_network_subnet", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnet)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetClusterNetworkSubnet : Retrieve a cluster network subnet
// This request retrieves a single cluster network subnet specified by the identifier in the URL.
func (vpc *VpcV1) GetClusterNetworkSubnet(getClusterNetworkSubnetOptions *GetClusterNetworkSubnetOptions) (result *ClusterNetworkSubnet, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetClusterNetworkSubnetWithContext(context.Background(), getClusterNetworkSubnetOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetClusterNetworkSubnetWithContext is an alternate form of the GetClusterNetworkSubnet method which supports a Context parameter
func (vpc *VpcV1) GetClusterNetworkSubnetWithContext(ctx context.Context, getClusterNetworkSubnetOptions *GetClusterNetworkSubnetOptions) (result *ClusterNetworkSubnet, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getClusterNetworkSubnetOptions, "getClusterNetworkSubnetOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getClusterNetworkSubnetOptions, "getClusterNetworkSubnetOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"cluster_network_id": *getClusterNetworkSubnetOptions.ClusterNetworkID,
"id": *getClusterNetworkSubnetOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetworkSubnet")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getClusterNetworkSubnetOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_cluster_network_subnet", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnet)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateClusterNetworkSubnet : Update a cluster network subnet
// This request updates a cluster network subnet with the information provided in a cluster network subnet patch object.
// The patch object is structured in the same way as a retrieved cluster network subnet and needs to contain only the
// information to be updated.
func (vpc *VpcV1) UpdateClusterNetworkSubnet(updateClusterNetworkSubnetOptions *UpdateClusterNetworkSubnetOptions) (result *ClusterNetworkSubnet, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateClusterNetworkSubnetWithContext(context.Background(), updateClusterNetworkSubnetOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdateClusterNetworkSubnetWithContext is an alternate form of the UpdateClusterNetworkSubnet method which supports a Context parameter
func (vpc *VpcV1) UpdateClusterNetworkSubnetWithContext(ctx context.Context, updateClusterNetworkSubnetOptions *UpdateClusterNetworkSubnetOptions) (result *ClusterNetworkSubnet, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updateClusterNetworkSubnetOptions, "updateClusterNetworkSubnetOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateClusterNetworkSubnetOptions, "updateClusterNetworkSubnetOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"cluster_network_id": *updateClusterNetworkSubnetOptions.ClusterNetworkID,
"id": *updateClusterNetworkSubnetOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{cluster_network_id}/subnets/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetworkSubnet")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateClusterNetworkSubnetOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddHeader("Content-Type", "application/merge-patch+json")
if updateClusterNetworkSubnetOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*updateClusterNetworkSubnetOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
_, err = builder.SetBodyContentJSON(updateClusterNetworkSubnetOptions.ClusterNetworkSubnetPatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_cluster_network_subnet", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetworkSubnet)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteClusterNetwork : Delete a cluster network
// This request deletes a cluster network. This operation cannot be reversed.
//
// For this request to succeed, virtual server instances must not reside in this cluster network.
func (vpc *VpcV1) DeleteClusterNetwork(deleteClusterNetworkOptions *DeleteClusterNetworkOptions) (result *ClusterNetwork, response *core.DetailedResponse, err error) {
result, response, err = vpc.DeleteClusterNetworkWithContext(context.Background(), deleteClusterNetworkOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteClusterNetworkWithContext is an alternate form of the DeleteClusterNetwork method which supports a Context parameter
func (vpc *VpcV1) DeleteClusterNetworkWithContext(ctx context.Context, deleteClusterNetworkOptions *DeleteClusterNetworkOptions) (result *ClusterNetwork, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteClusterNetworkOptions, "deleteClusterNetworkOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteClusterNetworkOptions, "deleteClusterNetworkOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *deleteClusterNetworkOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteClusterNetwork")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteClusterNetworkOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
if deleteClusterNetworkOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*deleteClusterNetworkOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "delete_cluster_network", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetwork)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetClusterNetwork : Retrieve a cluster network
// This request retrieves a single cluster network specified by the identifier in the URL.
func (vpc *VpcV1) GetClusterNetwork(getClusterNetworkOptions *GetClusterNetworkOptions) (result *ClusterNetwork, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetClusterNetworkWithContext(context.Background(), getClusterNetworkOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetClusterNetworkWithContext is an alternate form of the GetClusterNetwork method which supports a Context parameter
func (vpc *VpcV1) GetClusterNetworkWithContext(ctx context.Context, getClusterNetworkOptions *GetClusterNetworkOptions) (result *ClusterNetwork, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getClusterNetworkOptions, "getClusterNetworkOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getClusterNetworkOptions, "getClusterNetworkOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *getClusterNetworkOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetClusterNetwork")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getClusterNetworkOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_cluster_network", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetwork)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateClusterNetwork : Update a cluster
// This request updates a cluster network with the information provided in a cluster network patch object. The patch
// object is structured in the same way as a retrieved cluster network and needs to contain only the information to be
// updated.
func (vpc *VpcV1) UpdateClusterNetwork(updateClusterNetworkOptions *UpdateClusterNetworkOptions) (result *ClusterNetwork, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateClusterNetworkWithContext(context.Background(), updateClusterNetworkOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdateClusterNetworkWithContext is an alternate form of the UpdateClusterNetwork method which supports a Context parameter
func (vpc *VpcV1) UpdateClusterNetworkWithContext(ctx context.Context, updateClusterNetworkOptions *UpdateClusterNetworkOptions) (result *ClusterNetwork, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updateClusterNetworkOptions, "updateClusterNetworkOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateClusterNetworkOptions, "updateClusterNetworkOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *updateClusterNetworkOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/cluster_networks/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateClusterNetwork")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateClusterNetworkOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddHeader("Content-Type", "application/merge-patch+json")
if updateClusterNetworkOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*updateClusterNetworkOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
_, err = builder.SetBodyContentJSON(updateClusterNetworkOptions.ClusterNetworkPatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_cluster_network", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterNetwork)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListPublicGateways : List public gateways
// This request lists 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) {
result, response, err = vpc.ListPublicGatewaysWithContext(context.Background(), listPublicGatewaysOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listPublicGatewaysOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_public_gateways", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.CreatePublicGatewayWithContext(context.Background(), createPublicGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createPublicGatewayOptions, "createPublicGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createPublicGatewayOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_public_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
response, err = vpc.DeletePublicGatewayWithContext(context.Background(), deletePublicGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deletePublicGatewayOptions, "deletePublicGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePublicGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deletePublicGatewayOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_public_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetPublicGatewayWithContext(context.Background(), getPublicGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getPublicGatewayOptions, "getPublicGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPublicGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getPublicGatewayOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_public_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.UpdatePublicGatewayWithContext(context.Background(), updatePublicGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updatePublicGatewayOptions, "updatePublicGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updatePublicGatewayOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_public_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListFloatingIps : List floating IPs
// This request lists 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) {
result, response, err = vpc.ListFloatingIpsWithContext(context.Background(), listFloatingIpsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listFloatingIpsOptions.Headers {
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))
}
if listFloatingIpsOptions.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listFloatingIpsOptions.Sort))
}
if listFloatingIpsOptions.TargetID != nil {
builder.AddQuery("target.id", fmt.Sprint(*listFloatingIpsOptions.TargetID))
}
if listFloatingIpsOptions.TargetCRN != nil {
builder.AddQuery("target.crn", fmt.Sprint(*listFloatingIpsOptions.TargetCRN))
}
if listFloatingIpsOptions.TargetName != nil {
builder.AddQuery("target.name", fmt.Sprint(*listFloatingIpsOptions.TargetName))
}
if listFloatingIpsOptions.TargetResourceType != nil {
builder.AddQuery("target.resource_type", fmt.Sprint(*listFloatingIpsOptions.TargetResourceType))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_floating_ips", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.CreateFloatingIPWithContext(context.Background(), createFloatingIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createFloatingIPOptions, "createFloatingIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFloatingIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createFloatingIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_floating_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteFloatingIP : Delete 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) {
response, err = vpc.DeleteFloatingIPWithContext(context.Background(), deleteFloatingIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteFloatingIPOptions, "deleteFloatingIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFloatingIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteFloatingIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_floating_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetFloatingIPWithContext(context.Background(), getFloatingIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getFloatingIPOptions, "getFloatingIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFloatingIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getFloatingIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_floating_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.UpdateFloatingIPWithContext(context.Background(), updateFloatingIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateFloatingIPOptions, "updateFloatingIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFloatingIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateFloatingIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_floating_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListPublicAddressRanges : List public address ranges
// This request lists [public address ranges](https://cloud.ibm.com/docs/vpc?topic=vpc-about-par) in the region. A
// public address range is a contiguous block of public IP addresses that can be bound to a `target` that specifies a
// `vpc` and a `zone`. Incoming traffic for these IP addresses will be routed according to the VPC's ingress routing
// table.
func (vpc *VpcV1) ListPublicAddressRanges(listPublicAddressRangesOptions *ListPublicAddressRangesOptions) (result *PublicAddressRangeCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListPublicAddressRangesWithContext(context.Background(), listPublicAddressRangesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListPublicAddressRangesWithContext is an alternate form of the ListPublicAddressRanges method which supports a Context parameter
func (vpc *VpcV1) ListPublicAddressRangesWithContext(ctx context.Context, listPublicAddressRangesOptions *ListPublicAddressRangesOptions) (result *PublicAddressRangeCollection, response *core.DetailedResponse, err error) {
err = core.ValidateStruct(listPublicAddressRangesOptions, "listPublicAddressRangesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_address_ranges`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicAddressRanges")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listPublicAddressRangesOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listPublicAddressRangesOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listPublicAddressRangesOptions.Start))
}
if listPublicAddressRangesOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listPublicAddressRangesOptions.Limit))
}
if listPublicAddressRangesOptions.ResourceGroupID != nil {
builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicAddressRangesOptions.ResourceGroupID))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_public_address_ranges", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicAddressRangeCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreatePublicAddressRange : Create a public address range
// This request creates a new public address range from a public address range prototype object. The prototype object is
// structured in the same way as a retrieved public address range, and contains the information necessary to create the
// new public address range.
func (vpc *VpcV1) CreatePublicAddressRange(createPublicAddressRangeOptions *CreatePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreatePublicAddressRangeWithContext(context.Background(), createPublicAddressRangeOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreatePublicAddressRangeWithContext is an alternate form of the CreatePublicAddressRange method which supports a Context parameter
func (vpc *VpcV1) CreatePublicAddressRangeWithContext(ctx context.Context, createPublicAddressRangeOptions *CreatePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createPublicAddressRangeOptions, "createPublicAddressRangeOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createPublicAddressRangeOptions, "createPublicAddressRangeOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_address_ranges`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicAddressRange")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createPublicAddressRangeOptions.Headers {
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 createPublicAddressRangeOptions.Ipv4AddressCount != nil {
body["ipv4_address_count"] = createPublicAddressRangeOptions.Ipv4AddressCount
}
if createPublicAddressRangeOptions.Name != nil {
body["name"] = createPublicAddressRangeOptions.Name
}
if createPublicAddressRangeOptions.ResourceGroup != nil {
body["resource_group"] = createPublicAddressRangeOptions.ResourceGroup
}
if createPublicAddressRangeOptions.Target != nil {
body["target"] = createPublicAddressRangeOptions.Target
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_public_address_range", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicAddressRange)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeletePublicAddressRange : Delete a public address range
// This request deletes a public address range. If the public address range is bound to a
// `target`, it will be unbound. This operation cannot be reversed.
func (vpc *VpcV1) DeletePublicAddressRange(deletePublicAddressRangeOptions *DeletePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) {
result, response, err = vpc.DeletePublicAddressRangeWithContext(context.Background(), deletePublicAddressRangeOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeletePublicAddressRangeWithContext is an alternate form of the DeletePublicAddressRange method which supports a Context parameter
func (vpc *VpcV1) DeletePublicAddressRangeWithContext(ctx context.Context, deletePublicAddressRangeOptions *DeletePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deletePublicAddressRangeOptions, "deletePublicAddressRangeOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deletePublicAddressRangeOptions, "deletePublicAddressRangeOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *deletePublicAddressRangeOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_address_ranges/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePublicAddressRange")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deletePublicAddressRangeOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "delete_public_address_range", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicAddressRange)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetPublicAddressRange : Retrieve a public address range
// This request retrieves a single public address range specified by the identifier in the URL.
func (vpc *VpcV1) GetPublicAddressRange(getPublicAddressRangeOptions *GetPublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetPublicAddressRangeWithContext(context.Background(), getPublicAddressRangeOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetPublicAddressRangeWithContext is an alternate form of the GetPublicAddressRange method which supports a Context parameter
func (vpc *VpcV1) GetPublicAddressRangeWithContext(ctx context.Context, getPublicAddressRangeOptions *GetPublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getPublicAddressRangeOptions, "getPublicAddressRangeOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getPublicAddressRangeOptions, "getPublicAddressRangeOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *getPublicAddressRangeOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_address_ranges/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPublicAddressRange")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getPublicAddressRangeOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_public_address_range", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicAddressRange)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdatePublicAddressRange : Update a public address range
// This request updates a public address range with the information in a provided public address range patch. The public
// address range patch object is structured in the same way as a retrieved public address range and contains only the
// information to be updated.
func (vpc *VpcV1) UpdatePublicAddressRange(updatePublicAddressRangeOptions *UpdatePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdatePublicAddressRangeWithContext(context.Background(), updatePublicAddressRangeOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdatePublicAddressRangeWithContext is an alternate form of the UpdatePublicAddressRange method which supports a Context parameter
func (vpc *VpcV1) UpdatePublicAddressRangeWithContext(ctx context.Context, updatePublicAddressRangeOptions *UpdatePublicAddressRangeOptions) (result *PublicAddressRange, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updatePublicAddressRangeOptions, "updatePublicAddressRangeOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updatePublicAddressRangeOptions, "updatePublicAddressRangeOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *updatePublicAddressRangeOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_address_ranges/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicAddressRange")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updatePublicAddressRangeOptions.Headers {
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(updatePublicAddressRangeOptions.PublicAddressRangePatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_public_address_range", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicAddressRange)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListNetworkAcls : List network ACLs
// This request lists network ACLs in the region. A network ACL defines a set of packet filtering rules for traffic in
// and out of the subnets the network ACL is attached to. No traffic is allowed by default. Both allow and deny rules
// can be defined, and rules are stateless so that reverse traffic in response to allowed traffic is not automatically
// allowed.
func (vpc *VpcV1) ListNetworkAcls(listNetworkAclsOptions *ListNetworkAclsOptions) (result *NetworkACLCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListNetworkAclsWithContext(context.Background(), listNetworkAclsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listNetworkAclsOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_network_acls", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateNetworkACL : Create a network ACL
// This request creates a new stateless 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) {
result, response, err = vpc.CreateNetworkACLWithContext(context.Background(), createNetworkACLOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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.ValidateNotNil(createNetworkACLOptions, "createNetworkACLOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createNetworkACLOptions, "createNetworkACLOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACL")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createNetworkACLOptions.Headers {
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(createNetworkACLOptions.NetworkACLPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_network_acl", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
response, err = vpc.DeleteNetworkACLWithContext(context.Background(), deleteNetworkACLOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteNetworkACLOptions, "deleteNetworkACLOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACL")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteNetworkACLOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_network_acl", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetNetworkACLWithContext(context.Background(), getNetworkACLOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getNetworkACLOptions, "getNetworkACLOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACL")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getNetworkACLOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_network_acl", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.UpdateNetworkACLWithContext(context.Background(), updateNetworkACLOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateNetworkACLOptions, "updateNetworkACLOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACL")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateNetworkACLOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_network_acl", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListNetworkACLRules : List rules for a network ACL
// This request lists 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) {
result, response, err = vpc.ListNetworkACLRulesWithContext(context.Background(), listNetworkACLRulesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listNetworkACLRulesOptions, "listNetworkACLRulesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkACLRules")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listNetworkACLRulesOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_network_acl_rules", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRuleCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.CreateNetworkACLRuleWithContext(context.Background(), createNetworkACLRuleOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createNetworkACLRuleOptions, "createNetworkACLRuleOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACLRule")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createNetworkACLRuleOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_network_acl_rule", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
response, err = vpc.DeleteNetworkACLRuleWithContext(context.Background(), deleteNetworkACLRuleOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_network_acl_rule", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetNetworkACLRuleWithContext(context.Background(), getNetworkACLRuleOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getNetworkACLRuleOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_network_acl_rule", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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 provided patch includes properties that are not used by the
// rule's protocol.
func (vpc *VpcV1) UpdateNetworkACLRule(updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateNetworkACLRuleWithContext(context.Background(), updateNetworkACLRuleOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACLRule")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateNetworkACLRuleOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_network_acl_rule", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListSecurityGroups : List security groups
// This request lists security groups in the region. A security group defines a set of packet filtering rules to allow
// traffic in and out of the resources targeted by the security group. No traffic is allowed by default. Security group
// rules are stateful so that reverse traffic in response to allowed traffic is automatically allowed.
func (vpc *VpcV1) ListSecurityGroups(listSecurityGroupsOptions *ListSecurityGroupsOptions) (result *SecurityGroupCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListSecurityGroupsWithContext(context.Background(), listSecurityGroupsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listSecurityGroupsOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_security_groups", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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 resources in that VPC can be added to the security group.
func (vpc *VpcV1) CreateSecurityGroup(createSecurityGroupOptions *CreateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateSecurityGroupWithContext(context.Background(), createSecurityGroupOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createSecurityGroupOptions, "createSecurityGroupOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createSecurityGroupOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_security_group", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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 security group
// targets or 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) {
response, err = vpc.DeleteSecurityGroupWithContext(context.Background(), deleteSecurityGroupOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteSecurityGroupOptions, "deleteSecurityGroupOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteSecurityGroupOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_security_group", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetSecurityGroupWithContext(context.Background(), getSecurityGroupOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getSecurityGroupOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_security_group", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.UpdateSecurityGroupWithContext(context.Background(), updateSecurityGroupOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateSecurityGroupOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_security_group", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListSecurityGroupRules : List rules in a security group
// This request lists 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) {
result, response, err = vpc.ListSecurityGroupRulesWithContext(context.Background(), listSecurityGroupRulesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listSecurityGroupRulesOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_security_group_rules", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRuleCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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 will 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) {
result, response, err = vpc.CreateSecurityGroupRuleWithContext(context.Background(), createSecurityGroupRuleOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createSecurityGroupRuleOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_security_group_rule", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
response, err = vpc.DeleteSecurityGroupRuleWithContext(context.Background(), deleteSecurityGroupRuleOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_security_group_rule", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetSecurityGroupRuleWithContext(context.Background(), getSecurityGroupRuleOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getSecurityGroupRuleOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_security_group_rule", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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 provided patch includes properties
// that are not used by the rule's protocol.
func (vpc *VpcV1) UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateSecurityGroupRuleWithContext(context.Background(), updateSecurityGroupRuleOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateSecurityGroupRuleOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_security_group_rule", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListSecurityGroupTargets : List targets associated with a security group
// This request lists 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) {
result, response, err = vpc.ListSecurityGroupTargetsWithContext(context.Background(), listSecurityGroupTargetsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupTargets")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listSecurityGroupTargetsOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_security_group_targets", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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 specified target identifier can be:
//
// - A bare metal server network interface identifier
// - A virtual network interface identifier
// - A VPN server identifier
// - A load balancer identifier
// - An endpoint gateway identifier
// - An instance network interface 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) {
response, err = vpc.DeleteSecurityGroupTargetBindingWithContext(context.Background(), deleteSecurityGroupTargetBindingOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteSecurityGroupTargetBindingOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_security_group_target_binding", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetSecurityGroupTargetWithContext(context.Background(), getSecurityGroupTargetOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupTarget")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getSecurityGroupTargetOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_security_group_target", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateSecurityGroupTargetBinding : Add a target to a security group
// This request adds a resource to an existing security group. The specified target identifier can be:
//
// - A bare metal server network interface identifier
// - A virtual network interface identifier
// - A VPN server identifier
// - A load balancer identifier
// - An endpoint gateway identifier
// - An instance network interface 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 provided, is ignored.
func (vpc *VpcV1) CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateSecurityGroupTargetBindingWithContext(context.Background(), createSecurityGroupTargetBindingOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createSecurityGroupTargetBindingOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_security_group_target_binding", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListIkePolicies : List IKE policies
// This request lists IKE policies in the region.
func (vpc *VpcV1) ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListIkePoliciesWithContext(context.Background(), listIkePoliciesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listIkePoliciesOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_ike_policies", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.CreateIkePolicyWithContext(context.Background(), createIkePolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createIkePolicyOptions, "createIkePolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIkePolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createIkePolicyOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_ike_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteIkePolicy : Delete an IKE policy
// This request deletes an IKE policy. This operation cannot be reversed. For this request to succeed, there must not be
// any VPN gateway connections using this policy.
func (vpc *VpcV1) DeleteIkePolicy(deleteIkePolicyOptions *DeleteIkePolicyOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeleteIkePolicyWithContext(context.Background(), deleteIkePolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteIkePolicyOptions, "deleteIkePolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteIkePolicyOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_ike_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetIkePolicyWithContext(context.Background(), getIkePolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getIkePolicyOptions, "getIkePolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIkePolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getIkePolicyOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_ike_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.UpdateIkePolicyWithContext(context.Background(), updateIkePolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIkePolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateIkePolicyOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_ike_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListIkePolicyConnections : List VPN gateway connections that use a specified IKE policy
// This request lists VPN gateway connections that use an IKE policy.
func (vpc *VpcV1) ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *IkePolicyConnectionCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListIkePolicyConnectionsWithContext is an alternate form of the ListIkePolicyConnections method which supports a Context parameter
func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *IkePolicyConnectionCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listIkePolicyConnectionsOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listIkePolicyConnectionsOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listIkePolicyConnectionsOptions.Start))
}
if listIkePolicyConnectionsOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listIkePolicyConnectionsOptions.Limit))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_ike_policy_connections", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyConnectionCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListIpsecPolicies : List IPsec policies
// This request lists IPsec policies in the region.
func (vpc *VpcV1) ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListIpsecPoliciesWithContext(context.Background(), listIpsecPoliciesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicies")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listIpsecPoliciesOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_ipsec_policies", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.CreateIpsecPolicyWithContext(context.Background(), createIpsecPolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createIpsecPolicyOptions, "createIpsecPolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIpsecPolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createIpsecPolicyOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_ipsec_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteIpsecPolicy : Delete an IPsec policy
// This request deletes an IPsec policy. This operation cannot be reversed. For this request to succeed, there must not
// be any VPN gateway connections using this policy.
func (vpc *VpcV1) DeleteIpsecPolicy(deleteIpsecPolicyOptions *DeleteIpsecPolicyOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeleteIpsecPolicyWithContext(context.Background(), deleteIpsecPolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteIpsecPolicyOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_ipsec_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetIpsecPolicyWithContext(context.Background(), getIpsecPolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getIpsecPolicyOptions, "getIpsecPolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getIpsecPolicyOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_ipsec_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.UpdateIpsecPolicyWithContext(context.Background(), updateIpsecPolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateIpsecPolicyOptions, "updateIpsecPolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIpsecPolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateIpsecPolicyOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_ipsec_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListIpsecPolicyConnections : List VPN gateway connections that use a specified IPsec policy
// This request lists VPN gateway connections that use an IPsec policy.
func (vpc *VpcV1) ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *IPsecPolicyConnectionCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListIpsecPolicyConnectionsWithContext is an alternate form of the ListIpsecPolicyConnections method which supports a Context parameter
func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *IPsecPolicyConnectionCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicyConnections")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listIpsecPolicyConnectionsOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listIpsecPolicyConnectionsOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listIpsecPolicyConnectionsOptions.Start))
}
if listIpsecPolicyConnectionsOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listIpsecPolicyConnectionsOptions.Limit))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_ipsec_policy_connections", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyConnectionCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListVPNGateways : List VPN gateways
// This request lists VPN gateways in the region.
func (vpc *VpcV1) ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListVPNGatewaysWithContext(context.Background(), listVPNGatewaysOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listVPNGatewaysOptions.Headers {
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.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listVPNGatewaysOptions.Sort))
}
if listVPNGatewaysOptions.Mode != nil {
builder.AddQuery("mode", fmt.Sprint(*listVPNGatewaysOptions.Mode))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_vpn_gateways", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.CreateVPNGatewayWithContext(context.Background(), createVPNGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createVPNGatewayOptions, "createVPNGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createVPNGatewayOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_vpn_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteVPNGateway : Delete a VPN gateway
// This request deletes a VPN gateway. This operation cannot be reversed. For this request to succeed, the VPN gateway
// must not have a `status` of `pending`, and there must not be any VPC routes using the VPN gateway's connections as a
// next hop.
func (vpc *VpcV1) DeleteVPNGateway(deleteVPNGatewayOptions *DeleteVPNGatewayOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeleteVPNGatewayWithContext(context.Background(), deleteVPNGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteVPNGatewayOptions, "deleteVPNGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteVPNGatewayOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_vpn_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetVPNGatewayWithContext(context.Background(), getVPNGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getVPNGatewayOptions, "getVPNGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getVPNGatewayOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_vpn_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.UpdateVPNGatewayWithContext(context.Background(), updateVPNGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateVPNGatewayOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_vpn_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListVPNGatewayConnections : List connections of a VPN gateway
// This request lists connections of a VPN gateway.
func (vpc *VpcV1) ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListVPNGatewayConnectionsWithContext(context.Background(), listVPNGatewayConnectionsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers {
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.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listVPNGatewayConnectionsOptions.Start))
}
if listVPNGatewayConnectionsOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listVPNGatewayConnectionsOptions.Limit))
}
if listVPNGatewayConnectionsOptions.Status != nil {
builder.AddQuery("status", fmt.Sprint(*listVPNGatewayConnectionsOptions.Status))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_vpn_gateway_connections", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.CreateVPNGatewayConnectionWithContext(context.Background(), createVPNGatewayConnectionOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGatewayConnection")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createVPNGatewayConnectionOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_vpn_gateway_connection", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteVPNGatewayConnection : Delete a VPN gateway connection
// This request deletes a VPN gateway connection. This operation cannot be reversed. For this request to succeed, there
// must not be VPC routes using this VPN connection as a next hop.
func (vpc *VpcV1) DeleteVPNGatewayConnection(deleteVPNGatewayConnectionOptions *DeleteVPNGatewayConnectionOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeleteVPNGatewayConnectionWithContext(context.Background(), deleteVPNGatewayConnectionOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_vpn_gateway_connection", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetVPNGatewayConnectionWithContext(context.Background(), getVPNGatewayConnectionOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGatewayConnection")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getVPNGatewayConnectionOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_vpn_gateway_connection", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.UpdateVPNGatewayConnectionWithContext(context.Background(), updateVPNGatewayConnectionOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGatewayConnection")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateVPNGatewayConnectionOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_vpn_gateway_connection", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListVPNGatewayConnectionsLocalCIDRs : List local CIDRs for a VPN gateway connection
// This request lists local CIDRs for a VPN gateway connection.
//
// This request is only supported for policy mode VPN gateways.
func (vpc *VpcV1) ListVPNGatewayConnectionsLocalCIDRs(listVPNGatewayConnectionsLocalCIDRsOptions *ListVPNGatewayConnectionsLocalCIDRsOptions) (result *VPNGatewayConnectionCIDRs, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListVPNGatewayConnectionsLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionsLocalCIDRsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListVPNGatewayConnectionsLocalCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionsLocalCIDRs method which supports a Context parameter
func (vpc *VpcV1) ListVPNGatewayConnectionsLocalCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionsLocalCIDRsOptions *ListVPNGatewayConnectionsLocalCIDRsOptions) (result *VPNGatewayConnectionCIDRs, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listVPNGatewayConnectionsLocalCIDRsOptions, "listVPNGatewayConnectionsLocalCIDRsOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listVPNGatewayConnectionsLocalCIDRsOptions, "listVPNGatewayConnectionsLocalCIDRsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"vpn_gateway_id": *listVPNGatewayConnectionsLocalCIDRsOptions.VPNGatewayID,
"id": *listVPNGatewayConnectionsLocalCIDRsOptions.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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsLocalCIDRs")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listVPNGatewayConnectionsLocalCIDRsOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_vpn_gateway_connections_local_cidrs", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCIDRs)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// RemoveVPNGatewayConnectionsLocalCIDR : Remove a local CIDR from a VPN gateway connection
// This request removes a CIDR from a VPN gateway connection.
//
// This request is only supported for policy mode VPN gateways.
func (vpc *VpcV1) RemoveVPNGatewayConnectionsLocalCIDR(removeVPNGatewayConnectionsLocalCIDROptions *RemoveVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) {
response, err = vpc.RemoveVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), removeVPNGatewayConnectionsLocalCIDROptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// RemoveVPNGatewayConnectionsLocalCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionsLocalCIDR method which supports a Context parameter
func (vpc *VpcV1) RemoveVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionsLocalCIDROptions *RemoveVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(removeVPNGatewayConnectionsLocalCIDROptions, "removeVPNGatewayConnectionsLocalCIDROptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(removeVPNGatewayConnectionsLocalCIDROptions, "removeVPNGatewayConnectionsLocalCIDROptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"vpn_gateway_id": *removeVPNGatewayConnectionsLocalCIDROptions.VPNGatewayID,
"id": *removeVPNGatewayConnectionsLocalCIDROptions.ID,
"cidr": *removeVPNGatewayConnectionsLocalCIDROptions.CIDR,
}
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}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsLocalCIDR")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range removeVPNGatewayConnectionsLocalCIDROptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "remove_vpn_gateway_connections_local_cidr", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// CheckVPNGatewayConnectionsLocalCIDR : 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.
//
// This request is only supported for policy mode VPN gateways.
func (vpc *VpcV1) CheckVPNGatewayConnectionsLocalCIDR(checkVPNGatewayConnectionsLocalCIDROptions *CheckVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) {
response, err = vpc.CheckVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionsLocalCIDROptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CheckVPNGatewayConnectionsLocalCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionsLocalCIDR method which supports a Context parameter
func (vpc *VpcV1) CheckVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionsLocalCIDROptions *CheckVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(checkVPNGatewayConnectionsLocalCIDROptions, "checkVPNGatewayConnectionsLocalCIDROptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(checkVPNGatewayConnectionsLocalCIDROptions, "checkVPNGatewayConnectionsLocalCIDROptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"vpn_gateway_id": *checkVPNGatewayConnectionsLocalCIDROptions.VPNGatewayID,
"id": *checkVPNGatewayConnectionsLocalCIDROptions.ID,
"cidr": *checkVPNGatewayConnectionsLocalCIDROptions.CIDR,
}
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}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsLocalCIDR")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range checkVPNGatewayConnectionsLocalCIDROptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "check_vpn_gateway_connections_local_cidr", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// AddVPNGatewayConnectionsLocalCIDR : Set a local CIDR on a VPN gateway connection
// This request adds the specified CIDR to the specified VPN gateway connection. This request succeeds if the specified
// CIDR already exists. A request body is not required, and if provided, is ignored.
//
// This request is only supported for policy mode VPN gateways.
func (vpc *VpcV1) AddVPNGatewayConnectionsLocalCIDR(addVPNGatewayConnectionsLocalCIDROptions *AddVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) {
response, err = vpc.AddVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionsLocalCIDROptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// AddVPNGatewayConnectionsLocalCIDRWithContext is an alternate form of the AddVPNGatewayConnectionsLocalCIDR method which supports a Context parameter
func (vpc *VpcV1) AddVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Context, addVPNGatewayConnectionsLocalCIDROptions *AddVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(addVPNGatewayConnectionsLocalCIDROptions, "addVPNGatewayConnectionsLocalCIDROptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(addVPNGatewayConnectionsLocalCIDROptions, "addVPNGatewayConnectionsLocalCIDROptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"vpn_gateway_id": *addVPNGatewayConnectionsLocalCIDROptions.VPNGatewayID,
"id": *addVPNGatewayConnectionsLocalCIDROptions.ID,
"cidr": *addVPNGatewayConnectionsLocalCIDROptions.CIDR,
}
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}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsLocalCIDR")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range addVPNGatewayConnectionsLocalCIDROptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "add_vpn_gateway_connections_local_cidr", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// ListVPNGatewayConnectionsPeerCIDRs : List peer CIDRs for a VPN gateway connection
// This request lists peer CIDRs for a VPN gateway connection.
//
// This request is only supported for policy mode VPN gateways.
func (vpc *VpcV1) ListVPNGatewayConnectionsPeerCIDRs(listVPNGatewayConnectionsPeerCIDRsOptions *ListVPNGatewayConnectionsPeerCIDRsOptions) (result *VPNGatewayConnectionCIDRs, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListVPNGatewayConnectionsPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionsPeerCIDRsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListVPNGatewayConnectionsPeerCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionsPeerCIDRs method which supports a Context parameter
func (vpc *VpcV1) ListVPNGatewayConnectionsPeerCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionsPeerCIDRsOptions *ListVPNGatewayConnectionsPeerCIDRsOptions) (result *VPNGatewayConnectionCIDRs, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listVPNGatewayConnectionsPeerCIDRsOptions, "listVPNGatewayConnectionsPeerCIDRsOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listVPNGatewayConnectionsPeerCIDRsOptions, "listVPNGatewayConnectionsPeerCIDRsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"vpn_gateway_id": *listVPNGatewayConnectionsPeerCIDRsOptions.VPNGatewayID,
"id": *listVPNGatewayConnectionsPeerCIDRsOptions.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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsPeerCIDRs")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listVPNGatewayConnectionsPeerCIDRsOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_vpn_gateway_connections_peer_cidrs", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCIDRs)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// RemoveVPNGatewayConnectionsPeerCIDR : Remove a peer CIDR from a VPN gateway connection
// This request removes a CIDR from a VPN gateway connection.
//
// This request is only supported for policy mode VPN gateways.
func (vpc *VpcV1) RemoveVPNGatewayConnectionsPeerCIDR(removeVPNGatewayConnectionsPeerCIDROptions *RemoveVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) {
response, err = vpc.RemoveVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionsPeerCIDROptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// RemoveVPNGatewayConnectionsPeerCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionsPeerCIDR method which supports a Context parameter
func (vpc *VpcV1) RemoveVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionsPeerCIDROptions *RemoveVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(removeVPNGatewayConnectionsPeerCIDROptions, "removeVPNGatewayConnectionsPeerCIDROptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(removeVPNGatewayConnectionsPeerCIDROptions, "removeVPNGatewayConnectionsPeerCIDROptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"vpn_gateway_id": *removeVPNGatewayConnectionsPeerCIDROptions.VPNGatewayID,
"id": *removeVPNGatewayConnectionsPeerCIDROptions.ID,
"cidr": *removeVPNGatewayConnectionsPeerCIDROptions.CIDR,
}
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}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsPeerCIDR")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range removeVPNGatewayConnectionsPeerCIDROptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "remove_vpn_gateway_connections_peer_cidr", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// CheckVPNGatewayConnectionsPeerCIDR : 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.
//
// This request is only supported for policy mode VPN gateways.
func (vpc *VpcV1) CheckVPNGatewayConnectionsPeerCIDR(checkVPNGatewayConnectionsPeerCIDROptions *CheckVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) {
response, err = vpc.CheckVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionsPeerCIDROptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CheckVPNGatewayConnectionsPeerCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionsPeerCIDR method which supports a Context parameter
func (vpc *VpcV1) CheckVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionsPeerCIDROptions *CheckVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(checkVPNGatewayConnectionsPeerCIDROptions, "checkVPNGatewayConnectionsPeerCIDROptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(checkVPNGatewayConnectionsPeerCIDROptions, "checkVPNGatewayConnectionsPeerCIDROptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"vpn_gateway_id": *checkVPNGatewayConnectionsPeerCIDROptions.VPNGatewayID,
"id": *checkVPNGatewayConnectionsPeerCIDROptions.ID,
"cidr": *checkVPNGatewayConnectionsPeerCIDROptions.CIDR,
}
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}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsPeerCIDR")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range checkVPNGatewayConnectionsPeerCIDROptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "check_vpn_gateway_connections_peer_cidr", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// AddVPNGatewayConnectionsPeerCIDR : Set a peer CIDR on a VPN gateway connection
// This request adds the specified CIDR to the specified VPN gateway connection. This request succeeds if the specified
// CIDR already exists. A request body is not required, and if provided, is ignored.
//
// This request is only supported for policy mode VPN gateways.
func (vpc *VpcV1) AddVPNGatewayConnectionsPeerCIDR(addVPNGatewayConnectionsPeerCIDROptions *AddVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) {
response, err = vpc.AddVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionsPeerCIDROptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// AddVPNGatewayConnectionsPeerCIDRWithContext is an alternate form of the AddVPNGatewayConnectionsPeerCIDR method which supports a Context parameter
func (vpc *VpcV1) AddVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Context, addVPNGatewayConnectionsPeerCIDROptions *AddVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(addVPNGatewayConnectionsPeerCIDROptions, "addVPNGatewayConnectionsPeerCIDROptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(addVPNGatewayConnectionsPeerCIDROptions, "addVPNGatewayConnectionsPeerCIDROptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"vpn_gateway_id": *addVPNGatewayConnectionsPeerCIDROptions.VPNGatewayID,
"id": *addVPNGatewayConnectionsPeerCIDROptions.ID,
"cidr": *addVPNGatewayConnectionsPeerCIDROptions.CIDR,
}
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}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsPeerCIDR")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range addVPNGatewayConnectionsPeerCIDROptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "add_vpn_gateway_connections_peer_cidr", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// ListVPNServers : List VPN servers
// This request lists VPN servers.
func (vpc *VpcV1) ListVPNServers(listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListVPNServersWithContext(context.Background(), listVPNServersOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListVPNServersWithContext is an alternate form of the ListVPNServers method which supports a Context parameter
func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) {
err = core.ValidateStruct(listVPNServersOptions, "listVPNServersOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listVPNServersOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listVPNServersOptions.Name != nil {
builder.AddQuery("name", fmt.Sprint(*listVPNServersOptions.Name))
}
if listVPNServersOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listVPNServersOptions.Start))
}
if listVPNServersOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listVPNServersOptions.Limit))
}
if listVPNServersOptions.ResourceGroupID != nil {
builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNServersOptions.ResourceGroupID))
}
if listVPNServersOptions.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listVPNServersOptions.Sort))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_vpn_servers", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateVPNServer : Create a VPN server
// This request creates a new VPN server.
func (vpc *VpcV1) CreateVPNServer(createVPNServerOptions *CreateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateVPNServerWithContext(context.Background(), createVPNServerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreateVPNServerWithContext is an alternate form of the CreateVPNServer method which supports a Context parameter
func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServerOptions *CreateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createVPNServerOptions, "createVPNServerOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createVPNServerOptions, "createVPNServerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createVPNServerOptions.Headers {
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 createVPNServerOptions.Certificate != nil {
body["certificate"] = createVPNServerOptions.Certificate
}
if createVPNServerOptions.ClientAuthentication != nil {
body["client_authentication"] = createVPNServerOptions.ClientAuthentication
}
if createVPNServerOptions.ClientIPPool != nil {
body["client_ip_pool"] = createVPNServerOptions.ClientIPPool
}
if createVPNServerOptions.Subnets != nil {
body["subnets"] = createVPNServerOptions.Subnets
}
if createVPNServerOptions.ClientDnsServerIps != nil {
body["client_dns_server_ips"] = createVPNServerOptions.ClientDnsServerIps
}
if createVPNServerOptions.ClientIdleTimeout != nil {
body["client_idle_timeout"] = createVPNServerOptions.ClientIdleTimeout
}
if createVPNServerOptions.EnableSplitTunneling != nil {
body["enable_split_tunneling"] = createVPNServerOptions.EnableSplitTunneling
}
if createVPNServerOptions.Name != nil {
body["name"] = createVPNServerOptions.Name
}
if createVPNServerOptions.Port != nil {
body["port"] = createVPNServerOptions.Port
}
if createVPNServerOptions.Protocol != nil {
body["protocol"] = createVPNServerOptions.Protocol
}
if createVPNServerOptions.ResourceGroup != nil {
body["resource_group"] = createVPNServerOptions.ResourceGroup
}
if createVPNServerOptions.SecurityGroups != nil {
body["security_groups"] = createVPNServerOptions.SecurityGroups
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_vpn_server", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteVPNServer : Delete a VPN server
// This request deletes a VPN server. This operation cannot be reversed.
func (vpc *VpcV1) DeleteVPNServer(deleteVPNServerOptions *DeleteVPNServerOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeleteVPNServerWithContext(context.Background(), deleteVPNServerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteVPNServerWithContext is an alternate form of the DeleteVPNServer method which supports a Context parameter
func (vpc *VpcV1) DeleteVPNServerWithContext(ctx context.Context, deleteVPNServerOptions *DeleteVPNServerOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteVPNServerOptions, "deleteVPNServerOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteVPNServerOptions, "deleteVPNServerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *deleteVPNServerOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServer")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteVPNServerOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
if deleteVPNServerOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*deleteVPNServerOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_vpn_server", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// GetVPNServer : Retrieve a VPN server
// This request retrieves a single VPN server specified by the identifier in the URL.
func (vpc *VpcV1) GetVPNServer(getVPNServerOptions *GetVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetVPNServerWithContext(context.Background(), getVPNServerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetVPNServerWithContext is an alternate form of the GetVPNServer method which supports a Context parameter
func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptions *GetVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getVPNServerOptions, "getVPNServerOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getVPNServerOptions, "getVPNServerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *getVPNServerOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getVPNServerOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_vpn_server", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateVPNServer : Update a VPN server
// This request updates the properties of an existing VPN server. Any updates other than to `name` will cause all
// connected VPN clients to be disconnected.
func (vpc *VpcV1) UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateVPNServerWithContext(context.Background(), updateVPNServerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdateVPNServerWithContext is an alternate form of the UpdateVPNServer method which supports a Context parameter
func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updateVPNServerOptions, "updateVPNServerOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateVPNServerOptions, "updateVPNServerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *updateVPNServerOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServer")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateVPNServerOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddHeader("Content-Type", "application/merge-patch+json")
if updateVPNServerOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*updateVPNServerOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
_, err = builder.SetBodyContentJSON(updateVPNServerOptions.VPNServerPatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_vpn_server", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetVPNServerClientConfiguration : Retrieve client configuration
// This request retrieves OpenVPN client configuration on a single VPN server specified by the identifier in the URL.
// This configuration includes directives compatible with OpenVPN releases 2.4 and 2.5.
func (vpc *VpcV1) GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions) (result *string, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetVPNServerClientConfigurationWithContext(context.Background(), getVPNServerClientConfigurationOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetVPNServerClientConfigurationWithContext is an alternate form of the GetVPNServerClientConfiguration method which supports a Context parameter
func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context, getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions) (result *string, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *getVPNServerClientConfigurationOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}/client_configuration`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getVPNServerClientConfigurationOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "text/plain")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, &result)
if err != nil {
core.EnrichHTTPProblem(err, "get_vpn_server_client_configuration", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// ListVPNServerClients : List VPN clients for a VPN server
// This request retrieves connected VPN clients, and any disconnected VPN clients that the VPN server has not yet
// deleted based on its auto-deletion policy.
func (vpc *VpcV1) ListVPNServerClients(listVPNServerClientsOptions *ListVPNServerClientsOptions) (result *VPNServerClientCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListVPNServerClientsWithContext(context.Background(), listVPNServerClientsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListVPNServerClientsWithContext is an alternate form of the ListVPNServerClients method which supports a Context parameter
func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNServerClientsOptions *ListVPNServerClientsOptions) (result *VPNServerClientCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listVPNServerClientsOptions, "listVPNServerClientsOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listVPNServerClientsOptions, "listVPNServerClientsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"vpn_server_id": *listVPNServerClientsOptions.VPNServerID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerClients")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listVPNServerClientsOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listVPNServerClientsOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listVPNServerClientsOptions.Start))
}
if listVPNServerClientsOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listVPNServerClientsOptions.Limit))
}
if listVPNServerClientsOptions.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listVPNServerClientsOptions.Sort))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_vpn_server_clients", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClientCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteVPNServerClient : Delete a VPN client
// This request disconnects and deletes the VPN client from the VPN server. The VPN client may reconnect unless its
// authentication permissions for the configured authentication methods (such as its client certificate) have been
// revoked.
func (vpc *VpcV1) DeleteVPNServerClient(deleteVPNServerClientOptions *DeleteVPNServerClientOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeleteVPNServerClientWithContext(context.Background(), deleteVPNServerClientOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteVPNServerClientWithContext is an alternate form of the DeleteVPNServerClient method which supports a Context parameter
func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVPNServerClientOptions *DeleteVPNServerClientOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteVPNServerClientOptions, "deleteVPNServerClientOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteVPNServerClientOptions, "deleteVPNServerClientOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"vpn_server_id": *deleteVPNServerClientOptions.VPNServerID,
"id": *deleteVPNServerClientOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerClient")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteVPNServerClientOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_vpn_server_client", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// GetVPNServerClient : Retrieve a VPN client
// This request retrieves a single VPN client specified by the identifier in the URL.
func (vpc *VpcV1) GetVPNServerClient(getVPNServerClientOptions *GetVPNServerClientOptions) (result *VPNServerClient, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetVPNServerClientWithContext(context.Background(), getVPNServerClientOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetVPNServerClientWithContext is an alternate form of the GetVPNServerClient method which supports a Context parameter
func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServerClientOptions *GetVPNServerClientOptions) (result *VPNServerClient, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getVPNServerClientOptions, "getVPNServerClientOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"vpn_server_id": *getVPNServerClientOptions.VPNServerID,
"id": *getVPNServerClientOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getVPNServerClientOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_vpn_server_client", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClient)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DisconnectVPNClient : Disconnect a VPN client
// This request disconnects the specified VPN client, and deletes the client according to the VPN server's auto-deletion
// policy. The VPN client may reconnect unless its authentication permissions for the configured authentication methods
// (such as its client certificate) have been revoked.
func (vpc *VpcV1) DisconnectVPNClient(disconnectVPNClientOptions *DisconnectVPNClientOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DisconnectVPNClientWithContext(context.Background(), disconnectVPNClientOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DisconnectVPNClientWithContext is an alternate form of the DisconnectVPNClient method which supports a Context parameter
func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnectVPNClientOptions *DisconnectVPNClientOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(disconnectVPNClientOptions, "disconnectVPNClientOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(disconnectVPNClientOptions, "disconnectVPNClientOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"vpn_server_id": *disconnectVPNClientOptions.VPNServerID,
"id": *disconnectVPNClientOptions.ID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}/disconnect`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DisconnectVPNClient")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range disconnectVPNClientOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "disconnect_vpn_client", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// ListVPNServerRoutes : List VPN routes for a VPN server
// This request lists VPN routes in a VPN server. All VPN routes are provided to the VPN client when the connection is
// established. Packets received from the VPN client will be dropped by the VPN server if there is no VPN route
// matching their specified destinations. All VPN routes must be unique within the VPN server.
func (vpc *VpcV1) ListVPNServerRoutes(listVPNServerRoutesOptions *ListVPNServerRoutesOptions) (result *VPNServerRouteCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListVPNServerRoutesWithContext(context.Background(), listVPNServerRoutesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListVPNServerRoutesWithContext is an alternate form of the ListVPNServerRoutes method which supports a Context parameter
func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNServerRoutesOptions *ListVPNServerRoutesOptions) (result *VPNServerRouteCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listVPNServerRoutesOptions, "listVPNServerRoutesOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"vpn_server_id": *listVPNServerRoutesOptions.VPNServerID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listVPNServerRoutesOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listVPNServerRoutesOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listVPNServerRoutesOptions.Start))
}
if listVPNServerRoutesOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listVPNServerRoutesOptions.Limit))
}
if listVPNServerRoutesOptions.Sort != nil {
builder.AddQuery("sort", fmt.Sprint(*listVPNServerRoutesOptions.Sort))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_vpn_server_routes", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRouteCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateVPNServerRoute : Create a VPN route for a VPN server
// This request creates a new VPN route in the VPN server. All VPN routes are provided to the VPN client when the
// connection is established. Packets received from the VPN client will be dropped by the VPN server if there is no VPN
// route matching their specified destinations. All VPN routes must be unique within the VPN server.
func (vpc *VpcV1) CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateVPNServerRouteWithContext(context.Background(), createVPNServerRouteOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreateVPNServerRouteWithContext is an alternate form of the CreateVPNServerRoute method which supports a Context parameter
func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createVPNServerRouteOptions, "createVPNServerRouteOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createVPNServerRouteOptions, "createVPNServerRouteOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"vpn_server_id": *createVPNServerRouteOptions.VPNServerID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createVPNServerRouteOptions.Headers {
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 createVPNServerRouteOptions.Destination != nil {
body["destination"] = createVPNServerRouteOptions.Destination
}
if createVPNServerRouteOptions.Action != nil {
body["action"] = createVPNServerRouteOptions.Action
}
if createVPNServerRouteOptions.Name != nil {
body["name"] = createVPNServerRouteOptions.Name
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_vpn_server_route", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteVPNServerRoute : Delete a VPN route
// This request deletes a VPN route. This operation cannot be reversed.
func (vpc *VpcV1) DeleteVPNServerRoute(deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeleteVPNServerRouteWithContext(context.Background(), deleteVPNServerRouteOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeleteVPNServerRouteWithContext is an alternate form of the DeleteVPNServerRoute method which supports a Context parameter
func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"vpn_server_id": *deleteVPNServerRouteOptions.VPNServerID,
"id": *deleteVPNServerRouteOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteVPNServerRouteOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_vpn_server_route", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// GetVPNServerRoute : Retrieve a VPN route
// This request retrieves a single VPN route specified by the identifier in the URL.
func (vpc *VpcV1) GetVPNServerRoute(getVPNServerRouteOptions *GetVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetVPNServerRouteWithContext(context.Background(), getVPNServerRouteOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetVPNServerRouteWithContext is an alternate form of the GetVPNServerRoute method which supports a Context parameter
func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServerRouteOptions *GetVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getVPNServerRouteOptions, "getVPNServerRouteOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getVPNServerRouteOptions, "getVPNServerRouteOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"vpn_server_id": *getVPNServerRouteOptions.VPNServerID,
"id": *getVPNServerRouteOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerRoute")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getVPNServerRouteOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_vpn_server_route", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateVPNServerRoute : Update a VPN route
// This request updates a VPN route with the information in a provided VPN route patch. The VPN route patch object is
// structured in the same way as a retrieved VPN route and contains only the information to be updated.
func (vpc *VpcV1) UpdateVPNServerRoute(updateVPNServerRouteOptions *UpdateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateVPNServerRouteWithContext(context.Background(), updateVPNServerRouteOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdateVPNServerRouteWithContext is an alternate form of the UpdateVPNServerRoute method which supports a Context parameter
func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPNServerRouteOptions *UpdateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updateVPNServerRouteOptions, "updateVPNServerRouteOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateVPNServerRouteOptions, "updateVPNServerRouteOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"vpn_server_id": *updateVPNServerRouteOptions.VPNServerID,
"id": *updateVPNServerRouteOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateVPNServerRouteOptions.Headers {
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(updateVPNServerRouteOptions.VPNServerRoutePatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_vpn_server_route", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListLoadBalancerProfiles : List load balancer profiles
// This request lists 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) {
result, response, err = vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerProfiles")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listLoadBalancerProfilesOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_load_balancer_profiles", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfileCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.GetLoadBalancerProfileWithContext(context.Background(), getLoadBalancerProfileOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getLoadBalancerProfileOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_load_balancer_profile", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfile)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListLoadBalancers : List load balancers
// This request lists load balancers in the region.
func (vpc *VpcV1) ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancers")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listLoadBalancersOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listLoadBalancersOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listLoadBalancersOptions.Start))
}
if listLoadBalancersOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listLoadBalancersOptions.Limit))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_load_balancers", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.CreateLoadBalancerWithContext(context.Background(), createLoadBalancerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createLoadBalancerOptions, "createLoadBalancerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancer")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createLoadBalancerOptions.Headers {
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.Dns != nil {
body["dns"] = createLoadBalancerOptions.Dns
}
if createLoadBalancerOptions.IsPrivatePath != nil {
body["is_private_path"] = createLoadBalancerOptions.IsPrivatePath
}
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.RouteMode != nil {
body["route_mode"] = createLoadBalancerOptions.RouteMode
}
if createLoadBalancerOptions.SecurityGroups != nil {
body["security_groups"] = createLoadBalancerOptions.SecurityGroups
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_load_balancer", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteLoadBalancer : Delete a load balancer
// This request deletes a load balancer. This operation cannot be reversed. A load balancer cannot be deleted if its
// `provisioning_status` is `delete_pending` or it is referenced by a resource.
func (vpc *VpcV1) DeleteLoadBalancer(deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteLoadBalancerOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
if deleteLoadBalancerOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*deleteLoadBalancerOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_load_balancer", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getLoadBalancerOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_load_balancer", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateLoadBalancer : Update a load balancer
// This request updates a load balancer with the information in a provided load balancer patch. The load balancer patch
// object is structured in the same way as a retrieved load balancer and contains only the information to be updated. A
// load balancer can only be updated if its `provisioning_status` is `active`.
func (vpc *VpcV1) UpdateLoadBalancer(updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancer")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateLoadBalancerOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddHeader("Content-Type", "application/merge-patch+json")
if updateLoadBalancerOptions.IfMatch != nil {
builder.AddHeader("If-Match", fmt.Sprint(*updateLoadBalancerOptions.IfMatch))
}
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
_, err = builder.SetBodyContentJSON(updateLoadBalancerOptions.LoadBalancerPatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_load_balancer", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetLoadBalancerStatistics : List 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) {
result, response, err = vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_load_balancer_statistics", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerStatistics)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListLoadBalancerListeners : List listeners for a load balancer
// This request lists listeners for a load balancer.
func (vpc *VpcV1) ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListLoadBalancerListenersWithContext(context.Background(), listLoadBalancerListenersOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listLoadBalancerListenersOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_load_balancer_listeners", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createLoadBalancerListenerOptions.Headers {
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.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.HTTPSRedirect != nil {
body["https_redirect"] = createLoadBalancerListenerOptions.HTTPSRedirect
}
if createLoadBalancerListenerOptions.IdleConnectionTimeout != nil {
body["idle_connection_timeout"] = createLoadBalancerListenerOptions.IdleConnectionTimeout
}
if createLoadBalancerListenerOptions.Policies != nil {
body["policies"] = createLoadBalancerListenerOptions.Policies
}
if createLoadBalancerListenerOptions.Port != nil {
body["port"] = createLoadBalancerListenerOptions.Port
}
if createLoadBalancerListenerOptions.PortMax != nil {
body["port_max"] = createLoadBalancerListenerOptions.PortMax
}
if createLoadBalancerListenerOptions.PortMin != nil {
body["port_min"] = createLoadBalancerListenerOptions.PortMin
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_load_balancer_listener", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteLoadBalancerListener : Delete a load balancer listener
// This request deletes a load balancer listener. This operation cannot be reversed. For this operation to succeed, the
// listener must not be the target of another load balancer listener.
func (vpc *VpcV1) DeleteLoadBalancerListener(deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_load_balancer_listener", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getLoadBalancerListenerOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_load_balancer_listener", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_load_balancer_listener", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListLoadBalancerListenerPolicies : List policies for a load balancer listener
// This request lists policies for a load balancer listener. A policy consists of rules to match against each incoming
// request, and an action to apply to the request if a rule matches.
func (vpc *VpcV1) ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_load_balancer_listener_policies", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateLoadBalancerListenerPolicy : Create a policy for a load balancer listener
// This request creates a new policy from a load balancer listener policy object. The prototype object is structured in
// the same way as a retrieved policy, and contains the information necessary to create the new policy. For this request
// to succeed, the load balancer must be in the `application` family.
func (vpc *VpcV1) CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_load_balancer_listener_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
response, err = vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_load_balancer_listener_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_load_balancer_listener_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateLoadBalancerListenerPolicy : Update a load balancer listener policy
// This request updates a load balancer listener policy with the information in a provided policy patch. The policy
// patch object is structured in the same way as a retrieved policy and contains only the information to be updated.
func (vpc *VpcV1) UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_load_balancer_listener_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListLoadBalancerListenerPolicyRules : List rules of a load balancer listener policy
// This request lists rules of a load balancer listener policy.
func (vpc *VpcV1) ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_load_balancer_listener_policy_rules", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRuleCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicyRule")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createLoadBalancerListenerPolicyRuleOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_load_balancer_listener_policy_rule", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
response, err = vpc.DeleteLoadBalancerListenerPolicyRuleWithContext(context.Background(), deleteLoadBalancerListenerPolicyRuleOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteLoadBalancerListenerPolicyRuleOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_load_balancer_listener_policy_rule", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_load_balancer_listener_policy_rule", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_load_balancer_listener_policy_rule", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListLoadBalancerPools : List pools of a load balancer
// This request lists pools of a load balancer.
func (vpc *VpcV1) ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listLoadBalancerPoolsOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_load_balancer_pools", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createLoadBalancerPoolOptions.Headers {
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.FailsafePolicy != nil {
body["failsafe_policy"] = createLoadBalancerPoolOptions.FailsafePolicy
}
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_load_balancer_pool", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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, nor be the target pool in the failsafe policy for any other pool.
func (vpc *VpcV1) DeleteLoadBalancerPool(deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_load_balancer_pool", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getLoadBalancerPoolOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_load_balancer_pool", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_load_balancer_pool", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListLoadBalancerPoolMembers : List members of a load balancer pool
// This request lists members of a load balancer pool.
func (vpc *VpcV1) ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_load_balancer_pool_members", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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.
//
// The pool must not already have a member targeting a load balancer.
func (vpc *VpcV1) CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_load_balancer_pool_member", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.ReplaceLoadBalancerPoolMembersWithContext(context.Background(), replaceLoadBalancerPoolMembersOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceLoadBalancerPoolMembers")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range replaceLoadBalancerPoolMembersOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "replace_load_balancer_pool_members", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
response, err = vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_load_balancer_pool_member", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_load_balancer_pool_member", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.UpdateLoadBalancerPoolMemberWithContext(context.Background(), updateLoadBalancerPoolMemberOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPoolMember")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateLoadBalancerPoolMemberOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_load_balancer_pool_member", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListEndpointGateways : List endpoint gateways
// This request lists endpoint gateways in the region. An endpoint gateway maps one or more reserved IPs in a VPC to a
// target outside the VPC.
//
// The endpoint gateways will be sorted by their `created_at` property values, with newest endpoint gateway first.
// Endpoint gateways with identical `created_at` property values will in turn be sorted by ascending `name` property
// values.
func (vpc *VpcV1) ListEndpointGateways(listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listEndpointGatewaysOptions.Headers {
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))
}
if listEndpointGatewaysOptions.LifecycleState != nil {
builder.AddQuery("lifecycle_state", strings.Join(listEndpointGatewaysOptions.LifecycleState, ","))
}
if listEndpointGatewaysOptions.VPCID != nil {
builder.AddQuery("vpc.id", fmt.Sprint(*listEndpointGatewaysOptions.VPCID))
}
if listEndpointGatewaysOptions.VPCCRN != nil {
builder.AddQuery("vpc.crn", fmt.Sprint(*listEndpointGatewaysOptions.VPCCRN))
}
if listEndpointGatewaysOptions.VPCName != nil {
builder.AddQuery("vpc.name", fmt.Sprint(*listEndpointGatewaysOptions.VPCName))
}
if listEndpointGatewaysOptions.AllowDnsResolutionBinding != nil {
builder.AddQuery("allow_dns_resolution_binding", fmt.Sprint(*listEndpointGatewaysOptions.AllowDnsResolutionBinding))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_endpoint_gateways", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreateEndpointGateway : Create an endpoint gateway
// This request creates a new endpoint gateway from an endpoint gateway prototype object. The prototype object is
// structured in the same way as a retrieved endpoint gateway, and contains the information necessary to create a new
// endpoint gateway. An endpoint gateway maps one or more reserved IPs in a VPC to a target service outside the VPC.
func (vpc *VpcV1) CreateEndpointGateway(createEndpointGatewayOptions *CreateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreateEndpointGatewayWithContext(context.Background(), createEndpointGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createEndpointGatewayOptions, "createEndpointGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateEndpointGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createEndpointGatewayOptions.Headers {
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.AllowDnsResolutionBinding != nil {
body["allow_dns_resolution_binding"] = createEndpointGatewayOptions.AllowDnsResolutionBinding
}
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
}
if createEndpointGatewayOptions.SecurityGroups != nil {
body["security_groups"] = createEndpointGatewayOptions.SecurityGroups
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_endpoint_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListEndpointGatewayIps : List reserved IPs bound to an endpoint gateway
// This request lists reserved IPs bound to an endpoint gateway.
func (vpc *VpcV1) ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGatewayIps")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_endpoint_gateway_ips", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionEndpointGatewayContext)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
response, err = vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "remove_endpoint_gateway_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// GetEndpointGatewayIP : Retrieve a reserved IP bound to an endpoint gateway
// This request 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) {
result, response, err = vpc.GetEndpointGatewayIPWithContext(context.Background(), getEndpointGatewayIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGatewayIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getEndpointGatewayIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_endpoint_gateway_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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, or not required by its target
// - 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) {
result, response, err = vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range addEndpointGatewayIPOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "add_endpoint_gateway_ip", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
response, err = vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteEndpointGatewayOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_endpoint_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetEndpointGatewayWithContext(context.Background(), getEndpointGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getEndpointGatewayOptions, "getEndpointGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getEndpointGatewayOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_endpoint_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdateEndpointGateway : Update an endpoint gateway
// This request updates an endpoint gateway with the information in a provided endpoint gateway patch. The endpoint
// gateway patch object is structured in the same way as a retrieved endpoint gateway and contains only the information
// to be updated.
func (vpc *VpcV1) UpdateEndpointGateway(updateEndpointGatewayOptions *UpdateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdateEndpointGatewayWithContext(context.Background(), updateEndpointGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateEndpointGatewayOptions, "updateEndpointGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateEndpointGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateEndpointGatewayOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_endpoint_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListFlowLogCollectors : List flow log collectors
// This request lists flow log collectors in the region. A [flow log
// collector](https://cloud.ibm.com/docs/vpc?topic=vpc-flow-logs) summarizes TCP and UDP data sent over the instance
// network interfaces and instance network attachments contained within its target. The collected flow logs are written
// to a cloud object storage bucket, where they can be [viewed](https://cloud.ibm.com/docs/vpc?topic=vpc-fl-analyze).
func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFlowLogCollectors")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listFlowLogCollectorsOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_flow_log_collectors", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollectorCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.CreateFlowLogCollectorWithContext(context.Background(), createFlowLogCollectorOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createFlowLogCollectorOptions, "createFlowLogCollectorOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFlowLogCollector")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createFlowLogCollectorOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_flow_log_collector", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeleteFlowLogCollector : Delete a flow log collector
// This request stops and deletes a flow log collector. This operation cannot be reversed.
//
// Collected flow logs remain available within the flow log collector's Cloud Object Storage bucket.
func (vpc *VpcV1) DeleteFlowLogCollector(deleteFlowLogCollectorOptions *DeleteFlowLogCollectorOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeleteFlowLogCollectorWithContext(context.Background(), deleteFlowLogCollectorOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFlowLogCollector")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deleteFlowLogCollectorOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_flow_log_collector", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
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) {
result, response, err = vpc.GetFlowLogCollectorWithContext(context.Background(), getFlowLogCollectorOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getFlowLogCollectorOptions, "getFlowLogCollectorOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFlowLogCollector")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getFlowLogCollectorOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_flow_log_collector", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
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) {
result, response, err = vpc.UpdateFlowLogCollectorWithContext(context.Background(), updateFlowLogCollectorOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// 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 {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFlowLogCollector")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updateFlowLogCollectorOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_flow_log_collector", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListPrivatePathServiceGateways : List private path service gateways
// This request lists private path service gateways in the region. Private path service gateways allow
// [service
// providers](https://cloud.ibm.com/docs/private-path?topic=private-path-private-path-service-architecture#private-path-service-components)
// to make their services available using
// [private path
// connectivity](https://cloud.ibm.com/docs/private-path?topic=private-path-private-path-service-architecture#private-path-service-components).
// Private path service gateways are used to facilitate and manage the private path connectivity between private path
// network load balancers and their associated endpoint gateways.
func (vpc *VpcV1) ListPrivatePathServiceGateways(listPrivatePathServiceGatewaysOptions *ListPrivatePathServiceGatewaysOptions) (result *PrivatePathServiceGatewayCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListPrivatePathServiceGatewaysWithContext(context.Background(), listPrivatePathServiceGatewaysOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListPrivatePathServiceGatewaysWithContext is an alternate form of the ListPrivatePathServiceGateways method which supports a Context parameter
func (vpc *VpcV1) ListPrivatePathServiceGatewaysWithContext(ctx context.Context, listPrivatePathServiceGatewaysOptions *ListPrivatePathServiceGatewaysOptions) (result *PrivatePathServiceGatewayCollection, response *core.DetailedResponse, err error) {
err = core.ValidateStruct(listPrivatePathServiceGatewaysOptions, "listPrivatePathServiceGatewaysOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGateways")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listPrivatePathServiceGatewaysOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listPrivatePathServiceGatewaysOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listPrivatePathServiceGatewaysOptions.Start))
}
if listPrivatePathServiceGatewaysOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listPrivatePathServiceGatewaysOptions.Limit))
}
if listPrivatePathServiceGatewaysOptions.ResourceGroupID != nil {
builder.AddQuery("resource_group.id", fmt.Sprint(*listPrivatePathServiceGatewaysOptions.ResourceGroupID))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_private_path_service_gateways", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreatePrivatePathServiceGateway : Create a private path service gateway
// This request creates a private path service gateway from a private path service gateway prototype object. The
// prototype object is structured in the same way as a retrieved private path service gateway, and contains the
// information necessary to create the new private path service gateway.
func (vpc *VpcV1) CreatePrivatePathServiceGateway(createPrivatePathServiceGatewayOptions *CreatePrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreatePrivatePathServiceGatewayWithContext(context.Background(), createPrivatePathServiceGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreatePrivatePathServiceGatewayWithContext is an alternate form of the CreatePrivatePathServiceGateway method which supports a Context parameter
func (vpc *VpcV1) CreatePrivatePathServiceGatewayWithContext(ctx context.Context, createPrivatePathServiceGatewayOptions *CreatePrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createPrivatePathServiceGatewayOptions, "createPrivatePathServiceGatewayOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createPrivatePathServiceGatewayOptions, "createPrivatePathServiceGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways`, nil)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePrivatePathServiceGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createPrivatePathServiceGatewayOptions.Headers {
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 createPrivatePathServiceGatewayOptions.LoadBalancer != nil {
body["load_balancer"] = createPrivatePathServiceGatewayOptions.LoadBalancer
}
if createPrivatePathServiceGatewayOptions.ServiceEndpoints != nil {
body["service_endpoints"] = createPrivatePathServiceGatewayOptions.ServiceEndpoints
}
if createPrivatePathServiceGatewayOptions.DefaultAccessPolicy != nil {
body["default_access_policy"] = createPrivatePathServiceGatewayOptions.DefaultAccessPolicy
}
if createPrivatePathServiceGatewayOptions.Name != nil {
body["name"] = createPrivatePathServiceGatewayOptions.Name
}
if createPrivatePathServiceGatewayOptions.ResourceGroup != nil {
body["resource_group"] = createPrivatePathServiceGatewayOptions.ResourceGroup
}
if createPrivatePathServiceGatewayOptions.ZonalAffinity != nil {
body["zonal_affinity"] = createPrivatePathServiceGatewayOptions.ZonalAffinity
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_private_path_service_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGateway)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeletePrivatePathServiceGateway : Delete a private path service gateway
// This request deletes a private path service gateway. For this request to succeed, the value of
// `endpoint_gateway_count` must be `0`. This operation cannot be reversed.
func (vpc *VpcV1) DeletePrivatePathServiceGateway(deletePrivatePathServiceGatewayOptions *DeletePrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeletePrivatePathServiceGatewayWithContext(context.Background(), deletePrivatePathServiceGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeletePrivatePathServiceGatewayWithContext is an alternate form of the DeletePrivatePathServiceGateway method which supports a Context parameter
func (vpc *VpcV1) DeletePrivatePathServiceGatewayWithContext(ctx context.Context, deletePrivatePathServiceGatewayOptions *DeletePrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deletePrivatePathServiceGatewayOptions, "deletePrivatePathServiceGatewayOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deletePrivatePathServiceGatewayOptions, "deletePrivatePathServiceGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *deletePrivatePathServiceGatewayOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePrivatePathServiceGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deletePrivatePathServiceGatewayOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_private_path_service_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// GetPrivatePathServiceGateway : Retrieve a private path service gateway
// This request retrieves the private path service gateway specified by the identifier in the URL.
func (vpc *VpcV1) GetPrivatePathServiceGateway(getPrivatePathServiceGatewayOptions *GetPrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetPrivatePathServiceGatewayWithContext(context.Background(), getPrivatePathServiceGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetPrivatePathServiceGatewayWithContext is an alternate form of the GetPrivatePathServiceGateway method which supports a Context parameter
func (vpc *VpcV1) GetPrivatePathServiceGatewayWithContext(ctx context.Context, getPrivatePathServiceGatewayOptions *GetPrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getPrivatePathServiceGatewayOptions, "getPrivatePathServiceGatewayOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getPrivatePathServiceGatewayOptions, "getPrivatePathServiceGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *getPrivatePathServiceGatewayOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getPrivatePathServiceGatewayOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_private_path_service_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGateway)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdatePrivatePathServiceGateway : Update a private path service gateway
// This request updates a private path service gateway with the information provided in a private path service gateway
// patch object. The private path service gateway patch object is structured in the same way as a retrieved private path
// service gateway and contains only the information to be updated.
func (vpc *VpcV1) UpdatePrivatePathServiceGateway(updatePrivatePathServiceGatewayOptions *UpdatePrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdatePrivatePathServiceGatewayWithContext(context.Background(), updatePrivatePathServiceGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdatePrivatePathServiceGatewayWithContext is an alternate form of the UpdatePrivatePathServiceGateway method which supports a Context parameter
func (vpc *VpcV1) UpdatePrivatePathServiceGatewayWithContext(ctx context.Context, updatePrivatePathServiceGatewayOptions *UpdatePrivatePathServiceGatewayOptions) (result *PrivatePathServiceGateway, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updatePrivatePathServiceGatewayOptions, "updatePrivatePathServiceGatewayOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updatePrivatePathServiceGatewayOptions, "updatePrivatePathServiceGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"id": *updatePrivatePathServiceGatewayOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePrivatePathServiceGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updatePrivatePathServiceGatewayOptions.Headers {
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(updatePrivatePathServiceGatewayOptions.PrivatePathServiceGatewayPatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_private_path_service_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGateway)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListPrivatePathServiceGatewayAccountPolicies : List account policies for a private path service gateway
// This request lists account policies for a private path service gateway. Each policy defines how requests to use the
// private path service gateway from that account will be handled.
//
// The account policies will be sorted by their `created_at` property values, with newest account policies first.
// Account policies with identical `created_at` property values will in turn be sorted by ascending `id` property
// values.
func (vpc *VpcV1) ListPrivatePathServiceGatewayAccountPolicies(listPrivatePathServiceGatewayAccountPoliciesOptions *ListPrivatePathServiceGatewayAccountPoliciesOptions) (result *PrivatePathServiceGatewayAccountPolicyCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListPrivatePathServiceGatewayAccountPoliciesWithContext(context.Background(), listPrivatePathServiceGatewayAccountPoliciesOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListPrivatePathServiceGatewayAccountPoliciesWithContext is an alternate form of the ListPrivatePathServiceGatewayAccountPolicies method which supports a Context parameter
func (vpc *VpcV1) ListPrivatePathServiceGatewayAccountPoliciesWithContext(ctx context.Context, listPrivatePathServiceGatewayAccountPoliciesOptions *ListPrivatePathServiceGatewayAccountPoliciesOptions) (result *PrivatePathServiceGatewayAccountPolicyCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listPrivatePathServiceGatewayAccountPoliciesOptions, "listPrivatePathServiceGatewayAccountPoliciesOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listPrivatePathServiceGatewayAccountPoliciesOptions, "listPrivatePathServiceGatewayAccountPoliciesOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"private_path_service_gateway_id": *listPrivatePathServiceGatewayAccountPoliciesOptions.PrivatePathServiceGatewayID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/account_policies`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGatewayAccountPolicies")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listPrivatePathServiceGatewayAccountPoliciesOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listPrivatePathServiceGatewayAccountPoliciesOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listPrivatePathServiceGatewayAccountPoliciesOptions.Start))
}
if listPrivatePathServiceGatewayAccountPoliciesOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listPrivatePathServiceGatewayAccountPoliciesOptions.Limit))
}
if listPrivatePathServiceGatewayAccountPoliciesOptions.AccountID != nil {
builder.AddQuery("account.id", fmt.Sprint(*listPrivatePathServiceGatewayAccountPoliciesOptions.AccountID))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_private_path_service_gateway_account_policies", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayAccountPolicyCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// CreatePrivatePathServiceGatewayAccountPolicy : Create an account policy for a private path service gateway
// This request creates an account policy from an account policy prototype object. The prototype object is structured in
// the same way as a retrieved account policy, and contains the information necessary to create the new account policy.
func (vpc *VpcV1) CreatePrivatePathServiceGatewayAccountPolicy(createPrivatePathServiceGatewayAccountPolicyOptions *CreatePrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) {
result, response, err = vpc.CreatePrivatePathServiceGatewayAccountPolicyWithContext(context.Background(), createPrivatePathServiceGatewayAccountPolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// CreatePrivatePathServiceGatewayAccountPolicyWithContext is an alternate form of the CreatePrivatePathServiceGatewayAccountPolicy method which supports a Context parameter
func (vpc *VpcV1) CreatePrivatePathServiceGatewayAccountPolicyWithContext(ctx context.Context, createPrivatePathServiceGatewayAccountPolicyOptions *CreatePrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(createPrivatePathServiceGatewayAccountPolicyOptions, "createPrivatePathServiceGatewayAccountPolicyOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(createPrivatePathServiceGatewayAccountPolicyOptions, "createPrivatePathServiceGatewayAccountPolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"private_path_service_gateway_id": *createPrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/account_policies`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePrivatePathServiceGatewayAccountPolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range createPrivatePathServiceGatewayAccountPolicyOptions.Headers {
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 createPrivatePathServiceGatewayAccountPolicyOptions.AccessPolicy != nil {
body["access_policy"] = createPrivatePathServiceGatewayAccountPolicyOptions.AccessPolicy
}
if createPrivatePathServiceGatewayAccountPolicyOptions.Account != nil {
body["account"] = createPrivatePathServiceGatewayAccountPolicyOptions.Account
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "create_private_path_service_gateway_account_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayAccountPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DeletePrivatePathServiceGatewayAccountPolicy : Delete an account policy for a private path service gateway
// This request deletes an account policy. This operation cannot be reversed and it does not affect the `status` of any
// existing endpoint gateway bindings.
func (vpc *VpcV1) DeletePrivatePathServiceGatewayAccountPolicy(deletePrivatePathServiceGatewayAccountPolicyOptions *DeletePrivatePathServiceGatewayAccountPolicyOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DeletePrivatePathServiceGatewayAccountPolicyWithContext(context.Background(), deletePrivatePathServiceGatewayAccountPolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DeletePrivatePathServiceGatewayAccountPolicyWithContext is an alternate form of the DeletePrivatePathServiceGatewayAccountPolicy method which supports a Context parameter
func (vpc *VpcV1) DeletePrivatePathServiceGatewayAccountPolicyWithContext(ctx context.Context, deletePrivatePathServiceGatewayAccountPolicyOptions *DeletePrivatePathServiceGatewayAccountPolicyOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(deletePrivatePathServiceGatewayAccountPolicyOptions, "deletePrivatePathServiceGatewayAccountPolicyOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(deletePrivatePathServiceGatewayAccountPolicyOptions, "deletePrivatePathServiceGatewayAccountPolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"private_path_service_gateway_id": *deletePrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID,
"id": *deletePrivatePathServiceGatewayAccountPolicyOptions.ID,
}
builder := core.NewRequestBuilder(core.DELETE)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/account_policies/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePrivatePathServiceGatewayAccountPolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range deletePrivatePathServiceGatewayAccountPolicyOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "delete_private_path_service_gateway_account_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// GetPrivatePathServiceGatewayAccountPolicy : Retrieve an account policy for a private path service gateway
// This request retrieves a single account policy specified by the identifier in the URL.
func (vpc *VpcV1) GetPrivatePathServiceGatewayAccountPolicy(getPrivatePathServiceGatewayAccountPolicyOptions *GetPrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetPrivatePathServiceGatewayAccountPolicyWithContext(context.Background(), getPrivatePathServiceGatewayAccountPolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetPrivatePathServiceGatewayAccountPolicyWithContext is an alternate form of the GetPrivatePathServiceGatewayAccountPolicy method which supports a Context parameter
func (vpc *VpcV1) GetPrivatePathServiceGatewayAccountPolicyWithContext(ctx context.Context, getPrivatePathServiceGatewayAccountPolicyOptions *GetPrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getPrivatePathServiceGatewayAccountPolicyOptions, "getPrivatePathServiceGatewayAccountPolicyOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getPrivatePathServiceGatewayAccountPolicyOptions, "getPrivatePathServiceGatewayAccountPolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"private_path_service_gateway_id": *getPrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID,
"id": *getPrivatePathServiceGatewayAccountPolicyOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/account_policies/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGatewayAccountPolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getPrivatePathServiceGatewayAccountPolicyOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_private_path_service_gateway_account_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayAccountPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// UpdatePrivatePathServiceGatewayAccountPolicy : Update an account policy for a private path service gateway
// This request updates an account policy with the information in a provided account policy patch. The account policy
// patch object is structured in the same way as a retrieved account policy and contains only the information to be
// updated.
func (vpc *VpcV1) UpdatePrivatePathServiceGatewayAccountPolicy(updatePrivatePathServiceGatewayAccountPolicyOptions *UpdatePrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) {
result, response, err = vpc.UpdatePrivatePathServiceGatewayAccountPolicyWithContext(context.Background(), updatePrivatePathServiceGatewayAccountPolicyOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UpdatePrivatePathServiceGatewayAccountPolicyWithContext is an alternate form of the UpdatePrivatePathServiceGatewayAccountPolicy method which supports a Context parameter
func (vpc *VpcV1) UpdatePrivatePathServiceGatewayAccountPolicyWithContext(ctx context.Context, updatePrivatePathServiceGatewayAccountPolicyOptions *UpdatePrivatePathServiceGatewayAccountPolicyOptions) (result *PrivatePathServiceGatewayAccountPolicy, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(updatePrivatePathServiceGatewayAccountPolicyOptions, "updatePrivatePathServiceGatewayAccountPolicyOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(updatePrivatePathServiceGatewayAccountPolicyOptions, "updatePrivatePathServiceGatewayAccountPolicyOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"private_path_service_gateway_id": *updatePrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID,
"id": *updatePrivatePathServiceGatewayAccountPolicyOptions.ID,
}
builder := core.NewRequestBuilder(core.PATCH)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/account_policies/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePrivatePathServiceGatewayAccountPolicy")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range updatePrivatePathServiceGatewayAccountPolicyOptions.Headers {
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(updatePrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayAccountPolicyPatch)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "update_private_path_service_gateway_account_policy", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayAccountPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// ListPrivatePathServiceGatewayEndpointGatewayBindings : List endpoint gateway bindings for a private path service gateway
// This request lists endpoint gateway bindings for a private path service gateway. Each endpoint gateway binding is
// implicitly created when an endpoint gateway is created targeting the private path service gateway. The associated
// account policy is applied to all new endpoint gateway bindings. If an associated account policy doesn't exist, the
// private path service gateway's `default_access_policy` is used.
//
// The endpoint gateway bindings will be sorted by their `created_at` property values, with newest endpoint gateway
// bindings first. Endpoint gateway bindings with identical
// `created_at` property values will in turn be sorted by ascending `name` property values.
func (vpc *VpcV1) ListPrivatePathServiceGatewayEndpointGatewayBindings(listPrivatePathServiceGatewayEndpointGatewayBindingsOptions *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) (result *PrivatePathServiceGatewayEndpointGatewayBindingCollection, response *core.DetailedResponse, err error) {
result, response, err = vpc.ListPrivatePathServiceGatewayEndpointGatewayBindingsWithContext(context.Background(), listPrivatePathServiceGatewayEndpointGatewayBindingsOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// ListPrivatePathServiceGatewayEndpointGatewayBindingsWithContext is an alternate form of the ListPrivatePathServiceGatewayEndpointGatewayBindings method which supports a Context parameter
func (vpc *VpcV1) ListPrivatePathServiceGatewayEndpointGatewayBindingsWithContext(ctx context.Context, listPrivatePathServiceGatewayEndpointGatewayBindingsOptions *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) (result *PrivatePathServiceGatewayEndpointGatewayBindingCollection, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(listPrivatePathServiceGatewayEndpointGatewayBindingsOptions, "listPrivatePathServiceGatewayEndpointGatewayBindingsOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(listPrivatePathServiceGatewayEndpointGatewayBindingsOptions, "listPrivatePathServiceGatewayEndpointGatewayBindingsOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"private_path_service_gateway_id": *listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.PrivatePathServiceGatewayID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGatewayEndpointGatewayBindings")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
if listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Start != nil {
builder.AddQuery("start", fmt.Sprint(*listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Start))
}
if listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Limit))
}
if listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Status != nil {
builder.AddQuery("status", fmt.Sprint(*listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Status))
}
if listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.AccountID != nil {
builder.AddQuery("account.id", fmt.Sprint(*listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.AccountID))
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "list_private_path_service_gateway_endpoint_gateway_bindings", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollection)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// GetPrivatePathServiceGatewayEndpointGatewayBinding : Retrieve an endpoint gateway binding for a private path service gateway
// This request retrieves a single endpoint gateway binding specified by the identifier in the URL.
func (vpc *VpcV1) GetPrivatePathServiceGatewayEndpointGatewayBinding(getPrivatePathServiceGatewayEndpointGatewayBindingOptions *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions) (result *PrivatePathServiceGatewayEndpointGatewayBinding, response *core.DetailedResponse, err error) {
result, response, err = vpc.GetPrivatePathServiceGatewayEndpointGatewayBindingWithContext(context.Background(), getPrivatePathServiceGatewayEndpointGatewayBindingOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// GetPrivatePathServiceGatewayEndpointGatewayBindingWithContext is an alternate form of the GetPrivatePathServiceGatewayEndpointGatewayBinding method which supports a Context parameter
func (vpc *VpcV1) GetPrivatePathServiceGatewayEndpointGatewayBindingWithContext(ctx context.Context, getPrivatePathServiceGatewayEndpointGatewayBindingOptions *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions) (result *PrivatePathServiceGatewayEndpointGatewayBinding, response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(getPrivatePathServiceGatewayEndpointGatewayBindingOptions, "getPrivatePathServiceGatewayEndpointGatewayBindingOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(getPrivatePathServiceGatewayEndpointGatewayBindingOptions, "getPrivatePathServiceGatewayEndpointGatewayBindingOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"private_path_service_gateway_id": *getPrivatePathServiceGatewayEndpointGatewayBindingOptions.PrivatePathServiceGatewayID,
"id": *getPrivatePathServiceGatewayEndpointGatewayBindingOptions.ID,
}
builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings/{id}`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGatewayEndpointGatewayBinding")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range getPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
var rawResponse map[string]json.RawMessage
response, err = vpc.Service.Request(request, &rawResponse)
if err != nil {
core.EnrichHTTPProblem(err, "get_private_path_service_gateway_endpoint_gateway_binding", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrivatePathServiceGatewayEndpointGatewayBinding)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo())
return
}
response.Result = result
}
return
}
// DenyPrivatePathServiceGatewayEndpointGatewayBinding : Deny an endpoint gateway binding for a private path service gateway
// This request denies a `pending` endpoint gateway request, and optionally sets the policy to deny future requests from
// the same account.
func (vpc *VpcV1) DenyPrivatePathServiceGatewayEndpointGatewayBinding(denyPrivatePathServiceGatewayEndpointGatewayBindingOptions *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.DenyPrivatePathServiceGatewayEndpointGatewayBindingWithContext(context.Background(), denyPrivatePathServiceGatewayEndpointGatewayBindingOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// DenyPrivatePathServiceGatewayEndpointGatewayBindingWithContext is an alternate form of the DenyPrivatePathServiceGatewayEndpointGatewayBinding method which supports a Context parameter
func (vpc *VpcV1) DenyPrivatePathServiceGatewayEndpointGatewayBindingWithContext(ctx context.Context, denyPrivatePathServiceGatewayEndpointGatewayBindingOptions *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(denyPrivatePathServiceGatewayEndpointGatewayBindingOptions, "denyPrivatePathServiceGatewayEndpointGatewayBindingOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(denyPrivatePathServiceGatewayEndpointGatewayBindingOptions, "denyPrivatePathServiceGatewayEndpointGatewayBindingOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"private_path_service_gateway_id": *denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.PrivatePathServiceGatewayID,
"id": *denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.ID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings/{id}/deny`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DenyPrivatePathServiceGatewayEndpointGatewayBinding")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
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 denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.SetAccountPolicy != nil {
body["set_account_policy"] = denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.SetAccountPolicy
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "deny_private_path_service_gateway_endpoint_gateway_binding", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// PermitPrivatePathServiceGatewayEndpointGatewayBinding : Permit an endpoint gateway binding for a private path service gateway
// This request permits a `pending` endpoint gateway request, and optionally sets the policy to permit future requests
// from the same account.
func (vpc *VpcV1) PermitPrivatePathServiceGatewayEndpointGatewayBinding(permitPrivatePathServiceGatewayEndpointGatewayBindingOptions *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.PermitPrivatePathServiceGatewayEndpointGatewayBindingWithContext(context.Background(), permitPrivatePathServiceGatewayEndpointGatewayBindingOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// PermitPrivatePathServiceGatewayEndpointGatewayBindingWithContext is an alternate form of the PermitPrivatePathServiceGatewayEndpointGatewayBinding method which supports a Context parameter
func (vpc *VpcV1) PermitPrivatePathServiceGatewayEndpointGatewayBindingWithContext(ctx context.Context, permitPrivatePathServiceGatewayEndpointGatewayBindingOptions *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(permitPrivatePathServiceGatewayEndpointGatewayBindingOptions, "permitPrivatePathServiceGatewayEndpointGatewayBindingOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(permitPrivatePathServiceGatewayEndpointGatewayBindingOptions, "permitPrivatePathServiceGatewayEndpointGatewayBindingOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"private_path_service_gateway_id": *permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.PrivatePathServiceGatewayID,
"id": *permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.ID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/endpoint_gateway_bindings/{id}/permit`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "PermitPrivatePathServiceGatewayEndpointGatewayBinding")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
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 permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.SetAccountPolicy != nil {
body["set_account_policy"] = permitPrivatePathServiceGatewayEndpointGatewayBindingOptions.SetAccountPolicy
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "permit_private_path_service_gateway_endpoint_gateway_binding", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// PublishPrivatePathServiceGateway : Publish a private path service gateway
// This request publishes a private path service gateway, allowing any account to request access to it.
func (vpc *VpcV1) PublishPrivatePathServiceGateway(publishPrivatePathServiceGatewayOptions *PublishPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.PublishPrivatePathServiceGatewayWithContext(context.Background(), publishPrivatePathServiceGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// PublishPrivatePathServiceGatewayWithContext is an alternate form of the PublishPrivatePathServiceGateway method which supports a Context parameter
func (vpc *VpcV1) PublishPrivatePathServiceGatewayWithContext(ctx context.Context, publishPrivatePathServiceGatewayOptions *PublishPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(publishPrivatePathServiceGatewayOptions, "publishPrivatePathServiceGatewayOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(publishPrivatePathServiceGatewayOptions, "publishPrivatePathServiceGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"private_path_service_gateway_id": *publishPrivatePathServiceGatewayOptions.PrivatePathServiceGatewayID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/publish`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "PublishPrivatePathServiceGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range publishPrivatePathServiceGatewayOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "publish_private_path_service_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// RevokeAccountForPrivatePathServiceGateway : Revoke access to a private path service gateway for an account
// This request revokes a consumer account. This operation cannot be reversed. The `status` of all endpoint gateway
// bindings associated with the specified private path service gateway become `denied`. If the specified account has an
// existing access policy, that policy will be updated to `denied`. Otherwise, a new `deny` access policy will be
// created for the account.
func (vpc *VpcV1) RevokeAccountForPrivatePathServiceGateway(revokeAccountForPrivatePathServiceGatewayOptions *RevokeAccountForPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.RevokeAccountForPrivatePathServiceGatewayWithContext(context.Background(), revokeAccountForPrivatePathServiceGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// RevokeAccountForPrivatePathServiceGatewayWithContext is an alternate form of the RevokeAccountForPrivatePathServiceGateway method which supports a Context parameter
func (vpc *VpcV1) RevokeAccountForPrivatePathServiceGatewayWithContext(ctx context.Context, revokeAccountForPrivatePathServiceGatewayOptions *RevokeAccountForPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(revokeAccountForPrivatePathServiceGatewayOptions, "revokeAccountForPrivatePathServiceGatewayOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(revokeAccountForPrivatePathServiceGatewayOptions, "revokeAccountForPrivatePathServiceGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"private_path_service_gateway_id": *revokeAccountForPrivatePathServiceGatewayOptions.PrivatePathServiceGatewayID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/revoke_account`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RevokeAccountForPrivatePathServiceGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range revokeAccountForPrivatePathServiceGatewayOptions.Headers {
builder.AddHeader(headerName, headerValue)
}
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 revokeAccountForPrivatePathServiceGatewayOptions.Account != nil {
body["account"] = revokeAccountForPrivatePathServiceGatewayOptions.Account
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo())
return
}
request, err := builder.Build()
if err != nil {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "revoke_account_for_private_path_service_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
// UnpublishPrivatePathServiceGateway : Unpublish a private path service gateway
// This request unpublishes a private path service gateway. For this request to succeed, any existing access from other
// accounts must first be revoked. Once unpublished, access will again be restricted to the account that created this
// private path service gateway.
func (vpc *VpcV1) UnpublishPrivatePathServiceGateway(unpublishPrivatePathServiceGatewayOptions *UnpublishPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) {
response, err = vpc.UnpublishPrivatePathServiceGatewayWithContext(context.Background(), unpublishPrivatePathServiceGatewayOptions)
err = core.RepurposeSDKProblem(err, "")
return
}
// UnpublishPrivatePathServiceGatewayWithContext is an alternate form of the UnpublishPrivatePathServiceGateway method which supports a Context parameter
func (vpc *VpcV1) UnpublishPrivatePathServiceGatewayWithContext(ctx context.Context, unpublishPrivatePathServiceGatewayOptions *UnpublishPrivatePathServiceGatewayOptions) (response *core.DetailedResponse, err error) {
err = core.ValidateNotNil(unpublishPrivatePathServiceGatewayOptions, "unpublishPrivatePathServiceGatewayOptions cannot be nil")
if err != nil {
err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo())
return
}
err = core.ValidateStruct(unpublishPrivatePathServiceGatewayOptions, "unpublishPrivatePathServiceGatewayOptions")
if err != nil {
err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo())
return
}
pathParamsMap := map[string]string{
"private_path_service_gateway_id": *unpublishPrivatePathServiceGatewayOptions.PrivatePathServiceGatewayID,
}
builder := core.NewRequestBuilder(core.POST)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = vpc.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/private_path_service_gateways/{private_path_service_gateway_id}/unpublish`, pathParamsMap)
if err != nil {
err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo())
return
}
sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnpublishPrivatePathServiceGateway")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
for headerName, headerValue := range unpublishPrivatePathServiceGatewayOptions.Headers {
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 {
err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo())
return
}
response, err = vpc.Service.Request(request, nil)
if err != nil {
core.EnrichHTTPProblem(err, "unpublish_private_path_service_gateway", getServiceComponentInfo())
err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo())
return
}
return
}
func getServiceComponentInfo() *core.ProblemComponent {
return core.NewProblemComponent(DefaultServiceName, "2025-07-08")
}
// AccountIdentity : Identifies an account by a unique property.
// Models which "extend" this model:
// - AccountIdentityByID
type AccountIdentity struct {
// The unique identifier for this account.
ID *string `json:"id,omitempty"`
}
func (*AccountIdentity) isaAccountIdentity() bool {
return true
}
type AccountIdentityIntf interface {
isaAccountIdentity() bool
}
// UnmarshalAccountIdentity unmarshals an instance of AccountIdentity from the specified map of raw messages.
func UnmarshalAccountIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(AccountIdentity)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AccountReference : AccountReference struct
type AccountReference struct {
// The unique identifier for this account.
ID *string `json:"id" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the AccountReference.ResourceType property.
// The resource type.
const (
AccountReferenceResourceTypeAccountConst = "account"
)
// UnmarshalAccountReference unmarshals an instance of AccountReference from the specified map of raw messages.
func UnmarshalAccountReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(AccountReference)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ActivateReservationOptions : The ActivateReservation options.
type ActivateReservationOptions struct {
// The reservation identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewActivateReservationOptions : Instantiate ActivateReservationOptions
func (*VpcV1) NewActivateReservationOptions(id string) *ActivateReservationOptions {
return &ActivateReservationOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *ActivateReservationOptions) SetID(id string) *ActivateReservationOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ActivateReservationOptions) SetHeaders(param map[string]string) *ActivateReservationOptions {
options.Headers = param
return options
}
// AddBareMetalServerNetworkInterfaceFloatingIPOptions : The AddBareMetalServerNetworkInterfaceFloatingIP options.
type AddBareMetalServerNetworkInterfaceFloatingIPOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// The bare metal server network interface identifier.
NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="`
// The floating IP identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewAddBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate AddBareMetalServerNetworkInterfaceFloatingIPOptions
func (*VpcV1) NewAddBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions {
return &AddBareMetalServerNetworkInterfaceFloatingIPOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
NetworkInterfaceID: core.StringPtr(networkInterfaceID),
ID: core.StringPtr(id),
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID
func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions {
_options.NetworkInterfaceID = core.StringPtr(networkInterfaceID)
return _options
}
// SetID : Allow user to set ID
func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions {
options.Headers = param
return options
}
// AddEndpointGatewayIPOptions : The AddEndpointGatewayIP options.
type AddEndpointGatewayIPOptions struct {
// The endpoint gateway identifier.
EndpointGatewayID *string `json:"endpoint_gateway_id" validate:"required,ne="`
// The reserved IP identifier.
ID *string `json:"id" 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 virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance network interface identifier.
NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="`
// The floating IP identifier.
ID *string `json:"id" 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
}
// AddNetworkInterfaceFloatingIPOptions : The AddNetworkInterfaceFloatingIP options.
type AddNetworkInterfaceFloatingIPOptions struct {
// The virtual network interface identifier.
VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="`
// The floating IP identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewAddNetworkInterfaceFloatingIPOptions : Instantiate AddNetworkInterfaceFloatingIPOptions
func (*VpcV1) NewAddNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *AddNetworkInterfaceFloatingIPOptions {
return &AddNetworkInterfaceFloatingIPOptions{
VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID),
ID: core.StringPtr(id),
}
}
// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID
func (_options *AddNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *AddNetworkInterfaceFloatingIPOptions {
_options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID)
return _options
}
// SetID : Allow user to set ID
func (_options *AddNetworkInterfaceFloatingIPOptions) SetID(id string) *AddNetworkInterfaceFloatingIPOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *AddNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddNetworkInterfaceFloatingIPOptions {
options.Headers = param
return options
}
// AddVirtualNetworkInterfaceIPOptions : The AddVirtualNetworkInterfaceIP options.
type AddVirtualNetworkInterfaceIPOptions struct {
// The virtual network interface identifier.
VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="`
// The reserved IP identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewAddVirtualNetworkInterfaceIPOptions : Instantiate AddVirtualNetworkInterfaceIPOptions
func (*VpcV1) NewAddVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *AddVirtualNetworkInterfaceIPOptions {
return &AddVirtualNetworkInterfaceIPOptions{
VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID),
ID: core.StringPtr(id),
}
}
// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID
func (_options *AddVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *AddVirtualNetworkInterfaceIPOptions {
_options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID)
return _options
}
// SetID : Allow user to set ID
func (_options *AddVirtualNetworkInterfaceIPOptions) SetID(id string) *AddVirtualNetworkInterfaceIPOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *AddVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *AddVirtualNetworkInterfaceIPOptions {
options.Headers = param
return options
}
// AddVPNGatewayConnectionsLocalCIDROptions : The AddVPNGatewayConnectionsLocalCIDR options.
type AddVPNGatewayConnectionsLocalCIDROptions struct {
// The VPN gateway identifier.
VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="`
// The VPN gateway connection identifier.
ID *string `json:"id" validate:"required,ne="`
// The IP address range in CIDR block notation.
CIDR *string `json:"cidr" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewAddVPNGatewayConnectionsLocalCIDROptions : Instantiate AddVPNGatewayConnectionsLocalCIDROptions
func (*VpcV1) NewAddVPNGatewayConnectionsLocalCIDROptions(vpnGatewayID string, id string, cidr string) *AddVPNGatewayConnectionsLocalCIDROptions {
return &AddVPNGatewayConnectionsLocalCIDROptions{
VPNGatewayID: core.StringPtr(vpnGatewayID),
ID: core.StringPtr(id),
CIDR: core.StringPtr(cidr),
}
}
// SetVPNGatewayID : Allow user to set VPNGatewayID
func (_options *AddVPNGatewayConnectionsLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionsLocalCIDROptions {
_options.VPNGatewayID = core.StringPtr(vpnGatewayID)
return _options
}
// SetID : Allow user to set ID
func (_options *AddVPNGatewayConnectionsLocalCIDROptions) SetID(id string) *AddVPNGatewayConnectionsLocalCIDROptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetCIDR : Allow user to set CIDR
func (_options *AddVPNGatewayConnectionsLocalCIDROptions) SetCIDR(cidr string) *AddVPNGatewayConnectionsLocalCIDROptions {
_options.CIDR = core.StringPtr(cidr)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *AddVPNGatewayConnectionsLocalCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionsLocalCIDROptions {
options.Headers = param
return options
}
// AddVPNGatewayConnectionsPeerCIDROptions : The AddVPNGatewayConnectionsPeerCIDR options.
type AddVPNGatewayConnectionsPeerCIDROptions struct {
// The VPN gateway identifier.
VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="`
// The VPN gateway connection identifier.
ID *string `json:"id" validate:"required,ne="`
// The IP address range in CIDR block notation.
CIDR *string `json:"cidr" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewAddVPNGatewayConnectionsPeerCIDROptions : Instantiate AddVPNGatewayConnectionsPeerCIDROptions
func (*VpcV1) NewAddVPNGatewayConnectionsPeerCIDROptions(vpnGatewayID string, id string, cidr string) *AddVPNGatewayConnectionsPeerCIDROptions {
return &AddVPNGatewayConnectionsPeerCIDROptions{
VPNGatewayID: core.StringPtr(vpnGatewayID),
ID: core.StringPtr(id),
CIDR: core.StringPtr(cidr),
}
}
// SetVPNGatewayID : Allow user to set VPNGatewayID
func (_options *AddVPNGatewayConnectionsPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionsPeerCIDROptions {
_options.VPNGatewayID = core.StringPtr(vpnGatewayID)
return _options
}
// SetID : Allow user to set ID
func (_options *AddVPNGatewayConnectionsPeerCIDROptions) SetID(id string) *AddVPNGatewayConnectionsPeerCIDROptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetCIDR : Allow user to set CIDR
func (_options *AddVPNGatewayConnectionsPeerCIDROptions) SetCIDR(cidr string) *AddVPNGatewayConnectionsPeerCIDROptions {
_options.CIDR = core.StringPtr(cidr)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *AddVPNGatewayConnectionsPeerCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionsPeerCIDROptions {
options.Headers = param
return options
}
// AddressPrefix : AddressPrefix struct
type AddressPrefix struct {
// The CIDR block for this address prefix.
CIDR *string `json:"cidr" validate:"required"`
// The date and time that this address prefix was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// Indicates whether subnets exist with addresses from this address 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 changed.
IsDefault *bool `json:"is_default" validate:"required"`
// The name for this address prefix. The name must not be used by another address prefix for the VPC.
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 {
err = core.SDKErrorf(err, "", "cidr-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "has_subnets", &obj.HasSubnets)
if err != nil {
err = core.SDKErrorf(err, "", "has_subnets-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault)
if err != nil {
err = core.SDKErrorf(err, "", "is_default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AddressPrefixCollection : AddressPrefixCollection struct
type AddressPrefixCollection struct {
// A page of address prefixes for the VPC.
AddressPrefixes []AddressPrefix `json:"address_prefixes" validate:"required"`
// A link to the first page of resources.
First *PageLink `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 *PageLink `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 {
err = core.SDKErrorf(err, "", "address_prefixes-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *AddressPrefixCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// 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 name for this address prefix. The name must not be used by another address prefix for the VPC.
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 {
err = core.SDKErrorf(err, "", "is_default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(addressPrefixPatch.IsDefault) {
_patch["is_default"] = addressPrefixPatch.IsDefault
}
if !core.IsNil(addressPrefixPatch.Name) {
_patch["name"] = addressPrefixPatch.Name
}
return
}
// BackupPolicy : BackupPolicy struct
// Models which "extend" this model:
// - BackupPolicyMatchResourceTypeInstance
// - BackupPolicyMatchResourceTypeVolume
// - BackupPolicyMatchResourceTypeShare
type BackupPolicy struct {
// The date and time that the backup policy was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The CRN for this backup policy.
CRN *string `json:"crn" validate:"required"`
// The reasons for the current `health_state` (if any).
HealthReasons []BackupPolicyHealthReason `json:"health_reasons" validate:"required"`
// The health of this resource:
// - `ok`: No abnormal behavior detected
// - `degraded`: Experiencing 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 backup policy.
Href *string `json:"href" validate:"required"`
// The unique identifier for this backup policy.
ID *string `json:"id" validate:"required"`
// The date and time that the most recent job for this backup policy completed.
//
// If absent, no job has yet completed for this backup policy.
LastJobCompletedAt *strfmt.DateTime `json:"last_job_completed_at,omitempty"`
// The lifecycle state of the backup policy.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The resource type this backup policy applies to. Resources that have both a matching type and a matching user tag
// will be subject to the backup policy.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
MatchResourceType *string `json:"match_resource_type" validate:"required"`
// The user tags this backup policy applies to. Resources that have both a matching user tag and a matching type will
// be subject to the backup policy.
MatchUserTags []string `json:"match_user_tags" validate:"required"`
// The name for this backup policy. The name is unique across all backup policies in the region.
Name *string `json:"name" validate:"required"`
// The plans for the backup policy.
Plans []BackupPolicyPlanReference `json:"plans" validate:"required"`
// The resource group for this backup policy.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The scope for this backup policy.
Scope BackupPolicyScopeIntf `json:"scope" validate:"required"`
// The included content for backups created using this policy:
// - `boot_volume`: Include the instance's boot volume.
// - `data_volumes`: Include the instance's data volumes.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
IncludedContent []string `json:"included_content,omitempty"`
}
// Constants associated with the BackupPolicy.HealthState property.
// The health of this resource:
// - `ok`: No abnormal behavior detected
// - `degraded`: Experiencing 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 (
BackupPolicyHealthStateDegradedConst = "degraded"
BackupPolicyHealthStateFaultedConst = "faulted"
BackupPolicyHealthStateInapplicableConst = "inapplicable"
BackupPolicyHealthStateOkConst = "ok"
)
// Constants associated with the BackupPolicy.LifecycleState property.
// The lifecycle state of the backup policy.
const (
BackupPolicyLifecycleStateDeletingConst = "deleting"
BackupPolicyLifecycleStateFailedConst = "failed"
BackupPolicyLifecycleStatePendingConst = "pending"
BackupPolicyLifecycleStateStableConst = "stable"
BackupPolicyLifecycleStateSuspendedConst = "suspended"
BackupPolicyLifecycleStateUpdatingConst = "updating"
BackupPolicyLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the BackupPolicy.MatchResourceType property.
// The resource type this backup policy applies to. Resources that have both a matching type and a matching user tag
// will be subject to the backup policy.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
BackupPolicyMatchResourceTypeInstanceConst = "instance"
BackupPolicyMatchResourceTypeShareConst = "share"
BackupPolicyMatchResourceTypeVolumeConst = "volume"
)
// Constants associated with the BackupPolicy.ResourceType property.
// The resource type.
const (
BackupPolicyResourceTypeBackupPolicyConst = "backup_policy"
)
// Constants associated with the BackupPolicy.IncludedContent property.
// An item to include.
const (
BackupPolicyIncludedContentBootVolumeConst = "boot_volume"
BackupPolicyIncludedContentDataVolumesConst = "data_volumes"
)
func (*BackupPolicy) isaBackupPolicy() bool {
return true
}
type BackupPolicyIntf interface {
isaBackupPolicy() bool
}
// UnmarshalBackupPolicy unmarshals an instance of BackupPolicy from the specified map of raw messages.
func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicy)
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalBackupPolicyHealthReason)
if err != nil {
err = core.SDKErrorf(err, "", "health_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState)
if err != nil {
err = core.SDKErrorf(err, "", "health_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "last_job_completed_at", &obj.LastJobCompletedAt)
if err != nil {
err = core.SDKErrorf(err, "", "last_job_completed_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags)
if err != nil {
err = core.SDKErrorf(err, "", "match_user_tags-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanReference)
if err != nil {
err = core.SDKErrorf(err, "", "plans-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScope)
if err != nil {
err = core.SDKErrorf(err, "", "scope-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent)
if err != nil {
err = core.SDKErrorf(err, "", "included_content-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyCollection : BackupPolicyCollection struct
type BackupPolicyCollection struct {
// A page of backup policies.
BackupPolicies []BackupPolicyIntf `json:"backup_policies" validate:"required"`
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalBackupPolicyCollection unmarshals an instance of BackupPolicyCollection from the specified map of raw messages.
func UnmarshalBackupPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyCollection)
err = core.UnmarshalModel(m, "backup_policies", &obj.BackupPolicies, UnmarshalBackupPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "backup_policies-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *BackupPolicyCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// BackupPolicyHealthReason : BackupPolicyHealthReason struct
type BackupPolicyHealthReason struct {
// A reason code for this health state.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this health state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this health state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the BackupPolicyHealthReason.Code property.
// A reason code for this health state.
const (
BackupPolicyHealthReasonCodeMissingServiceAuthorizationPoliciesConst = "missing_service_authorization_policies"
)
// UnmarshalBackupPolicyHealthReason unmarshals an instance of BackupPolicyHealthReason from the specified map of raw messages.
func UnmarshalBackupPolicyHealthReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyHealthReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyJob : BackupPolicyJob struct
type BackupPolicyJob struct {
// Indicates whether this backup policy job will be automatically deleted after it completes. At present, this is
// always `true`, but may be modifiable in the future.
AutoDelete *bool `json:"auto_delete" validate:"required"`
// If `auto_delete` is `true`, the days after completion that this backup policy job will be deleted. This value may be
// modifiable in the future.
AutoDeleteAfter *int64 `json:"auto_delete_after" validate:"required"`
// The backup policy plan operated this backup policy job (may be
// [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)).
BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan" validate:"required"`
// The date and time that the backup policy job was completed.
//
// If absent, the backup policy job has not yet completed.
CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"`
// The date and time that the backup policy job was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The URL for this backup policy job.
Href *string `json:"href" validate:"required"`
// The unique identifier for this backup policy job.
ID *string `json:"id" validate:"required"`
// The type of backup policy job.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
JobType *string `json:"job_type" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The source this backup was created from (may be
// [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)).
Source BackupPolicyJobSourceIntf `json:"source" validate:"required"`
// The status of the backup policy job.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
// The reasons for the current status (if any).
StatusReasons []BackupPolicyJobStatusReason `json:"status_reasons" validate:"required"`
// The snapshots operated on by this backup policy job (may be
// [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)).
TargetSnapshots []BackupPolicyTargetSnapshotIntf `json:"target_snapshots" validate:"required"`
}
// Constants associated with the BackupPolicyJob.JobType property.
// The type of backup policy job.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
BackupPolicyJobJobTypeCreationConst = "creation"
BackupPolicyJobJobTypeDeletionConst = "deletion"
)
// Constants associated with the BackupPolicyJob.ResourceType property.
// The resource type.
const (
BackupPolicyJobResourceTypeBackupPolicyJobConst = "backup_policy_job"
)
// Constants associated with the BackupPolicyJob.Status property.
// The status of the backup policy job.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
BackupPolicyJobStatusFailedConst = "failed"
BackupPolicyJobStatusRunningConst = "running"
BackupPolicyJobStatusSucceededConst = "succeeded"
)
// UnmarshalBackupPolicyJob unmarshals an instance of BackupPolicyJob from the specified map of raw messages.
func UnmarshalBackupPolicyJob(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyJob)
err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "auto_delete_after", &obj.AutoDeleteAfter)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete_after-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference)
if err != nil {
err = core.SDKErrorf(err, "", "backup_policy_plan-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt)
if err != nil {
err = core.SDKErrorf(err, "", "completed_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "job_type", &obj.JobType)
if err != nil {
err = core.SDKErrorf(err, "", "job_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalBackupPolicyJobSource)
if err != nil {
err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBackupPolicyJobStatusReason)
if err != nil {
err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target_snapshots", &obj.TargetSnapshots, UnmarshalBackupPolicyTargetSnapshot)
if err != nil {
err = core.SDKErrorf(err, "", "target_snapshots-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyJobCollection : BackupPolicyJobCollection struct
type BackupPolicyJobCollection struct {
// A link to the first page of resources.
First *PageLink `json:"first" validate:"required"`
// A page of jobs for the backup policy.
Jobs []BackupPolicyJob `json:"jobs" 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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalBackupPolicyJobCollection unmarshals an instance of BackupPolicyJobCollection from the specified map of raw messages.
func UnmarshalBackupPolicyJobCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyJobCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "jobs", &obj.Jobs, UnmarshalBackupPolicyJob)
if err != nil {
err = core.SDKErrorf(err, "", "jobs-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *BackupPolicyJobCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// BackupPolicyJobSource : The source this backup was created from (may be
// [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)).
// Models which "extend" this model:
// - BackupPolicyJobSourceVolumeReference
// - BackupPolicyJobSourceInstanceReference
// - BackupPolicyJobSourceShareReference
type BackupPolicyJobSource struct {
// The CRN for this volume.
CRN *string `json:"crn,omitempty"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this volume.
Href *string `json:"href,omitempty"`
// The unique identifier for this volume.
ID *string `json:"id,omitempty"`
// The name for this volume. The name is unique across all volumes in the region.
Name *string `json:"name,omitempty"`
// If present, this property indicates that the resource associated with this reference
// is remote and therefore may not be directly retrievable.
Remote *VolumeRemote `json:"remote,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type,omitempty"`
}
// Constants associated with the BackupPolicyJobSource.ResourceType property.
// The resource type.
const (
BackupPolicyJobSourceResourceTypeVolumeConst = "volume"
)
func (*BackupPolicyJobSource) isaBackupPolicyJobSource() bool {
return true
}
type BackupPolicyJobSourceIntf interface {
isaBackupPolicyJobSource() bool
}
// UnmarshalBackupPolicyJobSource unmarshals an instance of BackupPolicyJobSource from the specified map of raw messages.
func UnmarshalBackupPolicyJobSource(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyJobSource)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote)
if err != nil {
err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyJobStatusReason : BackupPolicyJobStatusReason struct
type BackupPolicyJobStatusReason struct {
// A reason code for the status:
// - `internal_error`: Internal error (contact IBM support)
// - `snapshot_encryption_key_invalid`: The provided encryption key is unavailable
// - `snapshot_pending`: Cannot delete backup (snapshot) in the `pending` lifecycle state
// - `snapshot_source_unsupported`: The source access control mode does not support
// backups
// - `snapshot_rate_too_high`: The rate of backups for the resource is too high
// - `snapshot_share_limit`: The maximum limit for snapshots on this resource has been
// reached
// - `snapshot_source_unavailable`: The source data is not available (for example,
// because the source is still being created).
// - `snapshot_volume_limit`: The snapshot limit for the source volume has been reached
// - `source_volume_busy`: The source volume has `busy` set (after multiple retries)
// - `source_volume_too_large`: The source volume exceeds the [maximum supported
// size](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-about&interface=api#snapshots-vpc-limitations)
// - `source_volume_unavailable`: The source volume is not attached to a running instance
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the status reason.
Message *string `json:"message" validate:"required"`
// A link to documentation about this status reason.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the BackupPolicyJobStatusReason.Code property.
// A reason code for the status:
// - `internal_error`: Internal error (contact IBM support)
// - `snapshot_encryption_key_invalid`: The provided encryption key is unavailable
// - `snapshot_pending`: Cannot delete backup (snapshot) in the `pending` lifecycle state
// - `snapshot_source_unsupported`: The source access control mode does not support
// backups
// - `snapshot_rate_too_high`: The rate of backups for the resource is too high
// - `snapshot_share_limit`: The maximum limit for snapshots on this resource has been
// reached
// - `snapshot_source_unavailable`: The source data is not available (for example,
// because the source is still being created).
// - `snapshot_volume_limit`: The snapshot limit for the source volume has been reached
// - `source_volume_busy`: The source volume has `busy` set (after multiple retries)
// - `source_volume_too_large`: The source volume exceeds the [maximum supported
// size](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-about&interface=api#snapshots-vpc-limitations)
// - `source_volume_unavailable`: The source volume is not attached to a running instance
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
BackupPolicyJobStatusReasonCodeInternalErrorConst = "internal_error"
BackupPolicyJobStatusReasonCodeSnapshotEncryptionKeyInvalidConst = "snapshot_encryption_key_invalid"
BackupPolicyJobStatusReasonCodeSnapshotPendingConst = "snapshot_pending"
BackupPolicyJobStatusReasonCodeSnapshotRateTooHighConst = "snapshot_rate_too_high"
BackupPolicyJobStatusReasonCodeSnapshotShareLimitConst = "snapshot_share_limit"
BackupPolicyJobStatusReasonCodeSnapshotSourceUnavailableConst = "snapshot_source_unavailable"
BackupPolicyJobStatusReasonCodeSnapshotSourceUnsupportedConst = "snapshot_source_unsupported"
BackupPolicyJobStatusReasonCodeSnapshotVolumeLimitConst = "snapshot_volume_limit"
BackupPolicyJobStatusReasonCodeSourceVolumeBusyConst = "source_volume_busy"
BackupPolicyJobStatusReasonCodeSourceVolumeTooLargeConst = "source_volume_too_large"
BackupPolicyJobStatusReasonCodeSourceVolumeUnavailableConst = "source_volume_unavailable"
)
// UnmarshalBackupPolicyJobStatusReason unmarshals an instance of BackupPolicyJobStatusReason from the specified map of raw messages.
func UnmarshalBackupPolicyJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyJobStatusReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyPatch : BackupPolicyPatch struct
type BackupPolicyPatch struct {
// The included content for backups created using this policy:
// - `boot_volume`: Include the instance's boot volume.
// - `data_volumes`: Include the instance's data volumes.
IncludedContent []string `json:"included_content,omitempty"`
// The user tags this backup policy will apply to (replacing any existing tags). Resources that have both a matching
// user tag and a matching type will be subject to the backup policy.
MatchUserTags []string `json:"match_user_tags,omitempty"`
// The name for this backup policy. The name must not be used by another backup policy in the region.
Name *string `json:"name,omitempty"`
}
// Constants associated with the BackupPolicyPatch.IncludedContent property.
// An item to include.
const (
BackupPolicyPatchIncludedContentBootVolumeConst = "boot_volume"
BackupPolicyPatchIncludedContentDataVolumesConst = "data_volumes"
)
// UnmarshalBackupPolicyPatch unmarshals an instance of BackupPolicyPatch from the specified map of raw messages.
func UnmarshalBackupPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyPatch)
err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent)
if err != nil {
err = core.SDKErrorf(err, "", "included_content-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags)
if err != nil {
err = core.SDKErrorf(err, "", "match_user_tags-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the BackupPolicyPatch
func (backupPolicyPatch *BackupPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(backupPolicyPatch.IncludedContent) {
_patch["included_content"] = backupPolicyPatch.IncludedContent
}
if !core.IsNil(backupPolicyPatch.MatchUserTags) {
_patch["match_user_tags"] = backupPolicyPatch.MatchUserTags
}
if !core.IsNil(backupPolicyPatch.Name) {
_patch["name"] = backupPolicyPatch.Name
}
return
}
// BackupPolicyPlan : BackupPolicyPlan struct
type BackupPolicyPlan struct {
// Indicates whether the plan is active.
Active *bool `json:"active" validate:"required"`
// The user tags to attach to backups (snapshots) created by this plan.
AttachUserTags []string `json:"attach_user_tags" validate:"required"`
ClonePolicy *BackupPolicyPlanClonePolicy `json:"clone_policy" validate:"required"`
// Indicates whether to copy the source's user tags to the created backups (snapshots).
CopyUserTags *bool `json:"copy_user_tags" validate:"required"`
// The date and time that the backup policy plan was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The cron specification for the backup schedule. The backup policy jobs
// (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes
// after this time.
//
// All backup schedules for plans in the same policy must be at least an hour apart.
CronSpec *string `json:"cron_spec" validate:"required"`
DeletionTrigger *BackupPolicyPlanDeletionTrigger `json:"deletion_trigger" validate:"required"`
// The URL for this backup policy plan.
Href *string `json:"href" validate:"required"`
// The unique identifier for this backup policy plan.
ID *string `json:"id" validate:"required"`
// The lifecycle state of this backup policy plan.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The name for this backup policy plan. The name is unique across all plans in the backup policy.
Name *string `json:"name" validate:"required"`
// The policies for additional backups in remote regions.
RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicy `json:"remote_region_policies" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the BackupPolicyPlan.LifecycleState property.
// The lifecycle state of this backup policy plan.
const (
BackupPolicyPlanLifecycleStateDeletingConst = "deleting"
BackupPolicyPlanLifecycleStateFailedConst = "failed"
BackupPolicyPlanLifecycleStatePendingConst = "pending"
BackupPolicyPlanLifecycleStateStableConst = "stable"
BackupPolicyPlanLifecycleStateSuspendedConst = "suspended"
BackupPolicyPlanLifecycleStateUpdatingConst = "updating"
BackupPolicyPlanLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the BackupPolicyPlan.ResourceType property.
// The resource type.
const (
BackupPolicyPlanResourceTypeBackupPolicyPlanConst = "backup_policy_plan"
)
// UnmarshalBackupPolicyPlan unmarshals an instance of BackupPolicyPlan from the specified map of raw messages.
func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyPlan)
err = core.UnmarshalPrimitive(m, "active", &obj.Active)
if err != nil {
err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags)
if err != nil {
err = core.SDKErrorf(err, "", "attach_user_tags-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicy)
if err != nil {
err = core.SDKErrorf(err, "", "clone_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags)
if err != nil {
err = core.SDKErrorf(err, "", "copy_user_tags-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec)
if err != nil {
err = core.SDKErrorf(err, "", "cron_spec-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTrigger)
if err != nil {
err = core.SDKErrorf(err, "", "deletion_trigger-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "remote_region_policies-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyPlanClonePolicy : BackupPolicyPlanClonePolicy struct
type BackupPolicyPlanClonePolicy struct {
// The maximum number of recent snapshots (per source) that will keep clones.
MaxSnapshots *int64 `json:"max_snapshots" validate:"required"`
// The zone this backup policy plan will create snapshot clones in.
Zones []ZoneReference `json:"zones" validate:"required"`
}
// UnmarshalBackupPolicyPlanClonePolicy unmarshals an instance of BackupPolicyPlanClonePolicy from the specified map of raw messages.
func UnmarshalBackupPolicyPlanClonePolicy(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyPlanClonePolicy)
err = core.UnmarshalPrimitive(m, "max_snapshots", &obj.MaxSnapshots)
if err != nil {
err = core.SDKErrorf(err, "", "max_snapshots-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zones-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyPlanClonePolicyPatch : BackupPolicyPlanClonePolicyPatch struct
type BackupPolicyPlanClonePolicyPatch struct {
// The maximum number of recent snapshots (per source) that will keep clones.
MaxSnapshots *int64 `json:"max_snapshots,omitempty"`
// The zones this backup policy plan will create snapshot clones in. Updating this value does not change the clones for
// snapshots that have already been created by this plan.
Zones []ZoneIdentityIntf `json:"zones,omitempty"`
}
// UnmarshalBackupPolicyPlanClonePolicyPatch unmarshals an instance of BackupPolicyPlanClonePolicyPatch from the specified map of raw messages.
func UnmarshalBackupPolicyPlanClonePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyPlanClonePolicyPatch)
err = core.UnmarshalPrimitive(m, "max_snapshots", &obj.MaxSnapshots)
if err != nil {
err = core.SDKErrorf(err, "", "max_snapshots-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zones-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the BackupPolicyPlanClonePolicyPatch
func (backupPolicyPlanClonePolicyPatch *BackupPolicyPlanClonePolicyPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(backupPolicyPlanClonePolicyPatch.MaxSnapshots) {
_patch["max_snapshots"] = backupPolicyPlanClonePolicyPatch.MaxSnapshots
}
if !core.IsNil(backupPolicyPlanClonePolicyPatch.Zones) {
var zonesPatches []map[string]interface{}
for _, zones := range backupPolicyPlanClonePolicyPatch.Zones {
zonesPatches = append(zonesPatches, zones.asPatch())
}
_patch["zones"] = zonesPatches
}
return
}
// BackupPolicyPlanClonePolicyPrototype : BackupPolicyPlanClonePolicyPrototype struct
type BackupPolicyPlanClonePolicyPrototype struct {
// The maximum number of recent snapshots (per source) that will keep clones.
MaxSnapshots *int64 `json:"max_snapshots,omitempty"`
// The zone this backup policy plan will create snapshot clones in.
Zones []ZoneIdentityIntf `json:"zones" validate:"required"`
}
// NewBackupPolicyPlanClonePolicyPrototype : Instantiate BackupPolicyPlanClonePolicyPrototype (Generic Model Constructor)
func (*VpcV1) NewBackupPolicyPlanClonePolicyPrototype(zones []ZoneIdentityIntf) (_model *BackupPolicyPlanClonePolicyPrototype, err error) {
_model = &BackupPolicyPlanClonePolicyPrototype{
Zones: zones,
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalBackupPolicyPlanClonePolicyPrototype unmarshals an instance of BackupPolicyPlanClonePolicyPrototype from the specified map of raw messages.
func UnmarshalBackupPolicyPlanClonePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyPlanClonePolicyPrototype)
err = core.UnmarshalPrimitive(m, "max_snapshots", &obj.MaxSnapshots)
if err != nil {
err = core.SDKErrorf(err, "", "max_snapshots-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zones-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyPlanCollection : BackupPolicyPlanCollection struct
type BackupPolicyPlanCollection struct {
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of plans for the backup policy.
Plans []BackupPolicyPlan `json:"plans" validate:"required"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalBackupPolicyPlanCollection unmarshals an instance of BackupPolicyPlanCollection from the specified map of raw messages.
func UnmarshalBackupPolicyPlanCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyPlanCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlan)
if err != nil {
err = core.SDKErrorf(err, "", "plans-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyPlanDeletionTrigger : BackupPolicyPlanDeletionTrigger struct
type BackupPolicyPlanDeletionTrigger struct {
// The maximum number of days to keep each backup after creation.
DeleteAfter *int64 `json:"delete_after" validate:"required"`
// The maximum number of recent backups to keep. If absent, there is no maximum.
DeleteOverCount *int64 `json:"delete_over_count,omitempty"`
}
// UnmarshalBackupPolicyPlanDeletionTrigger unmarshals an instance of BackupPolicyPlanDeletionTrigger from the specified map of raw messages.
func UnmarshalBackupPolicyPlanDeletionTrigger(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyPlanDeletionTrigger)
err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter)
if err != nil {
err = core.SDKErrorf(err, "", "delete_after-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount)
if err != nil {
err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyPlanDeletionTriggerPatch : BackupPolicyPlanDeletionTriggerPatch struct
type BackupPolicyPlanDeletionTriggerPatch struct {
// The maximum number of days to keep each backup after creation.
DeleteAfter *int64 `json:"delete_after,omitempty"`
// The maximum number of recent backups to keep. Specify `null` to remove any existing maximum.
DeleteOverCount *int64 `json:"delete_over_count,omitempty"`
}
// UnmarshalBackupPolicyPlanDeletionTriggerPatch unmarshals an instance of BackupPolicyPlanDeletionTriggerPatch from the specified map of raw messages.
func UnmarshalBackupPolicyPlanDeletionTriggerPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyPlanDeletionTriggerPatch)
err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter)
if err != nil {
err = core.SDKErrorf(err, "", "delete_after-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount)
if err != nil {
err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the BackupPolicyPlanDeletionTriggerPatch
func (backupPolicyPlanDeletionTriggerPatch *BackupPolicyPlanDeletionTriggerPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(backupPolicyPlanDeletionTriggerPatch.DeleteAfter) {
_patch["delete_after"] = backupPolicyPlanDeletionTriggerPatch.DeleteAfter
}
if !core.IsNil(backupPolicyPlanDeletionTriggerPatch.DeleteOverCount) {
_patch["delete_over_count"] = backupPolicyPlanDeletionTriggerPatch.DeleteOverCount
}
return
}
// BackupPolicyPlanDeletionTriggerPrototype : BackupPolicyPlanDeletionTriggerPrototype struct
type BackupPolicyPlanDeletionTriggerPrototype struct {
// The maximum number of days to keep each backup after creation.
DeleteAfter *int64 `json:"delete_after,omitempty"`
// The maximum number of recent backups to keep. If unspecified, there will be no maximum.
DeleteOverCount *int64 `json:"delete_over_count,omitempty"`
}
// UnmarshalBackupPolicyPlanDeletionTriggerPrototype unmarshals an instance of BackupPolicyPlanDeletionTriggerPrototype from the specified map of raw messages.
func UnmarshalBackupPolicyPlanDeletionTriggerPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyPlanDeletionTriggerPrototype)
err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter)
if err != nil {
err = core.SDKErrorf(err, "", "delete_after-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount)
if err != nil {
err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyPlanPatch : BackupPolicyPlanPatch struct
type BackupPolicyPlanPatch struct {
// Indicates whether the plan is active.
Active *bool `json:"active,omitempty"`
// The user tags to attach to backups (snapshots) created by this plan. Updating this value does not change the user
// tags for backups that have already been created by this plan.
AttachUserTags []string `json:"attach_user_tags,omitempty"`
ClonePolicy *BackupPolicyPlanClonePolicyPatch `json:"clone_policy,omitempty"`
// Indicates whether to copy the source's user tags to the created backups (snapshots).
CopyUserTags *bool `json:"copy_user_tags,omitempty"`
// The cron specification for the backup schedule. The backup policy jobs
// (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes
// after this time.
//
// All backup schedules for plans in the same policy must be at least an hour apart.
CronSpec *string `json:"cron_spec,omitempty"`
DeletionTrigger *BackupPolicyPlanDeletionTriggerPatch `json:"deletion_trigger,omitempty"`
// The name for this backup policy plan. The name must not be used by another plan for the backup policy.
Name *string `json:"name,omitempty"`
// The policies for additional backups in remote regions (replacing any existing policies).
RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"`
}
// UnmarshalBackupPolicyPlanPatch unmarshals an instance of BackupPolicyPlanPatch from the specified map of raw messages.
func UnmarshalBackupPolicyPlanPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyPlanPatch)
err = core.UnmarshalPrimitive(m, "active", &obj.Active)
if err != nil {
err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags)
if err != nil {
err = core.SDKErrorf(err, "", "attach_user_tags-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPatch)
if err != nil {
err = core.SDKErrorf(err, "", "clone_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags)
if err != nil {
err = core.SDKErrorf(err, "", "copy_user_tags-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec)
if err != nil {
err = core.SDKErrorf(err, "", "cron_spec-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPatch)
if err != nil {
err = core.SDKErrorf(err, "", "deletion_trigger-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "remote_region_policies-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the BackupPolicyPlanPatch
func (backupPolicyPlanPatch *BackupPolicyPlanPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(backupPolicyPlanPatch.Active) {
_patch["active"] = backupPolicyPlanPatch.Active
}
if !core.IsNil(backupPolicyPlanPatch.AttachUserTags) {
_patch["attach_user_tags"] = backupPolicyPlanPatch.AttachUserTags
}
if !core.IsNil(backupPolicyPlanPatch.ClonePolicy) {
_patch["clone_policy"] = backupPolicyPlanPatch.ClonePolicy.asPatch()
}
if !core.IsNil(backupPolicyPlanPatch.CopyUserTags) {
_patch["copy_user_tags"] = backupPolicyPlanPatch.CopyUserTags
}
if !core.IsNil(backupPolicyPlanPatch.CronSpec) {
_patch["cron_spec"] = backupPolicyPlanPatch.CronSpec
}
if !core.IsNil(backupPolicyPlanPatch.DeletionTrigger) {
_patch["deletion_trigger"] = backupPolicyPlanPatch.DeletionTrigger.asPatch()
}
if !core.IsNil(backupPolicyPlanPatch.Name) {
_patch["name"] = backupPolicyPlanPatch.Name
}
if !core.IsNil(backupPolicyPlanPatch.RemoteRegionPolicies) {
var remoteRegionPoliciesPatches []map[string]interface{}
for _, remoteRegionPolicies := range backupPolicyPlanPatch.RemoteRegionPolicies {
remoteRegionPoliciesPatches = append(remoteRegionPoliciesPatches, remoteRegionPolicies.asPatch())
}
_patch["remote_region_policies"] = remoteRegionPoliciesPatches
}
return
}
// BackupPolicyPlanPrototype : BackupPolicyPlanPrototype struct
type BackupPolicyPlanPrototype struct {
// Indicates whether the plan is active.
Active *bool `json:"active,omitempty"`
// The user tags to attach to each backup (snapshot) created by this plan.
AttachUserTags []string `json:"attach_user_tags,omitempty"`
ClonePolicy *BackupPolicyPlanClonePolicyPrototype `json:"clone_policy,omitempty"`
// Indicates whether to copy the source's user tags to the created backups (snapshots).
CopyUserTags *bool `json:"copy_user_tags,omitempty"`
// The cron specification for the backup schedule. The backup policy jobs
// (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes
// after this time.
//
// All backup schedules for plans in the same policy must be at least an hour apart.
CronSpec *string `json:"cron_spec" validate:"required"`
DeletionTrigger *BackupPolicyPlanDeletionTriggerPrototype `json:"deletion_trigger,omitempty"`
// The name for this backup policy plan. The name must not be used by another plan for the backup policy. If
// unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The policies for additional backups in remote regions.
RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"`
}
// NewBackupPolicyPlanPrototype : Instantiate BackupPolicyPlanPrototype (Generic Model Constructor)
func (*VpcV1) NewBackupPolicyPlanPrototype(cronSpec string) (_model *BackupPolicyPlanPrototype, err error) {
_model = &BackupPolicyPlanPrototype{
CronSpec: core.StringPtr(cronSpec),
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalBackupPolicyPlanPrototype unmarshals an instance of BackupPolicyPlanPrototype from the specified map of raw messages.
func UnmarshalBackupPolicyPlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyPlanPrototype)
err = core.UnmarshalPrimitive(m, "active", &obj.Active)
if err != nil {
err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags)
if err != nil {
err = core.SDKErrorf(err, "", "attach_user_tags-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "clone_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags)
if err != nil {
err = core.SDKErrorf(err, "", "copy_user_tags-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec)
if err != nil {
err = core.SDKErrorf(err, "", "cron_spec-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "deletion_trigger-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "remote_region_policies-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyPlanReference : BackupPolicyPlanReference struct
type BackupPolicyPlanReference struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this backup policy plan.
Href *string `json:"href" validate:"required"`
// The unique identifier for this backup policy plan.
ID *string `json:"id" validate:"required"`
// The name for this backup policy plan. The name is unique across all plans in the backup policy.
Name *string `json:"name" validate:"required"`
// If present, this property indicates that the resource associated with this reference
// is remote and therefore may not be directly retrievable.
Remote *BackupPolicyPlanRemote `json:"remote,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the BackupPolicyPlanReference.ResourceType property.
// The resource type.
const (
BackupPolicyPlanReferenceResourceTypeBackupPolicyPlanConst = "backup_policy_plan"
)
// UnmarshalBackupPolicyPlanReference unmarshals an instance of BackupPolicyPlanReference from the specified map of raw messages.
func UnmarshalBackupPolicyPlanReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyPlanReference)
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalBackupPolicyPlanRemote)
if err != nil {
err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyPlanRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not
// be directly retrievable.
type BackupPolicyPlanRemote struct {
// If present, this property indicates that the referenced resource is remote to this
// region, and identifies the native region.
Region *RegionReference `json:"region,omitempty"`
}
// UnmarshalBackupPolicyPlanRemote unmarshals an instance of BackupPolicyPlanRemote from the specified map of raw messages.
func UnmarshalBackupPolicyPlanRemote(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyPlanRemote)
err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference)
if err != nil {
err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyPlanRemoteRegionPolicy : BackupPolicyPlanRemoteRegionPolicy struct
type BackupPolicyPlanRemoteRegionPolicy struct {
// The region this backup policy plan will create backups in.
DeleteOverCount *int64 `json:"delete_over_count" validate:"required"`
// The root key used to rewrap the data encryption key for the backup (snapshot).
EncryptionKey *EncryptionKeyReference `json:"encryption_key" validate:"required"`
// The region this backup policy plan will create backups in.
Region *RegionReference `json:"region" validate:"required"`
}
// UnmarshalBackupPolicyPlanRemoteRegionPolicy unmarshals an instance of BackupPolicyPlanRemoteRegionPolicy from the specified map of raw messages.
func UnmarshalBackupPolicyPlanRemoteRegionPolicy(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyPlanRemoteRegionPolicy)
err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount)
if err != nil {
err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference)
if err != nil {
err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference)
if err != nil {
err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyPlanRemoteRegionPolicyPrototype : BackupPolicyPlanRemoteRegionPolicyPrototype struct
type BackupPolicyPlanRemoteRegionPolicyPrototype struct {
// The region this backup policy plan will create backups in.
DeleteOverCount *int64 `json:"delete_over_count,omitempty"`
// The root key to use to rewrap the data encryption key for the backup (snapshot).
//
// If unspecified, the source's `encryption_key` will be used.
// The specified key may be in a different account, subject to IAM policies.
EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"`
// The region this backup policy plan will create backups in.
Region RegionIdentityIntf `json:"region" validate:"required"`
}
// NewBackupPolicyPlanRemoteRegionPolicyPrototype : Instantiate BackupPolicyPlanRemoteRegionPolicyPrototype (Generic Model Constructor)
func (*VpcV1) NewBackupPolicyPlanRemoteRegionPolicyPrototype(region RegionIdentityIntf) (_model *BackupPolicyPlanRemoteRegionPolicyPrototype, err error) {
_model = &BackupPolicyPlanRemoteRegionPolicyPrototype{
Region: region,
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype unmarshals an instance of BackupPolicyPlanRemoteRegionPolicyPrototype from the specified map of raw messages.
func UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyPlanRemoteRegionPolicyPrototype)
err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount)
if err != nil {
err = core.SDKErrorf(err, "", "delete_over_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the BackupPolicyPlanRemoteRegionPolicyPrototype
func (backupPolicyPlanRemoteRegionPolicyPrototype *BackupPolicyPlanRemoteRegionPolicyPrototype) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(backupPolicyPlanRemoteRegionPolicyPrototype.DeleteOverCount) {
_patch["delete_over_count"] = backupPolicyPlanRemoteRegionPolicyPrototype.DeleteOverCount
}
if !core.IsNil(backupPolicyPlanRemoteRegionPolicyPrototype.EncryptionKey) {
_patch["encryption_key"] = backupPolicyPlanRemoteRegionPolicyPrototype.EncryptionKey.asPatch()
}
if !core.IsNil(backupPolicyPlanRemoteRegionPolicyPrototype.Region) {
_patch["region"] = backupPolicyPlanRemoteRegionPolicyPrototype.Region.asPatch()
}
return
}
// BackupPolicyPrototype : BackupPolicyPrototype struct
// Models which "extend" this model:
// - BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype
// - BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype
// - BackupPolicyPrototypeBackupPolicyMatchResourceTypeSharePrototype
type BackupPolicyPrototype struct {
// The resource type this backup policy will apply to. Resources that have both a matching type and a matching user tag
// will be subject to the backup policy.
MatchResourceType *string `json:"match_resource_type" validate:"required"`
// The user tags this backup policy will apply to. Resources that have both a matching user tag and a matching type
// will be subject to the backup policy.
MatchUserTags []string `json:"match_user_tags" validate:"required"`
// The name for this backup policy. The name must not be used by another backup policy in the region. If unspecified,
// the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The prototype objects for backup plans to be created for this backup policy.
Plans []BackupPolicyPlanPrototype `json:"plans,omitempty"`
// The resource group to use. If unspecified, the account's [default resource
// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The scope to use for this backup policy.
//
// If unspecified, the policy will be scoped to the account.
Scope BackupPolicyScopePrototypeIntf `json:"scope,omitempty"`
// The included content for backups created using this policy:
// - `boot_volume`: Include the instance's boot volume.
// - `data_volumes`: Include the instance's data volumes.
IncludedContent []string `json:"included_content,omitempty"`
}
// Constants associated with the BackupPolicyPrototype.MatchResourceType property.
// The resource type this backup policy will apply to. Resources that have both a matching type and a matching user tag
// will be subject to the backup policy.
const (
BackupPolicyPrototypeMatchResourceTypeInstanceConst = "instance"
BackupPolicyPrototypeMatchResourceTypeShareConst = "share"
BackupPolicyPrototypeMatchResourceTypeVolumeConst = "volume"
)
// Constants associated with the BackupPolicyPrototype.IncludedContent property.
// An item to include.
const (
BackupPolicyPrototypeIncludedContentBootVolumeConst = "boot_volume"
BackupPolicyPrototypeIncludedContentDataVolumesConst = "data_volumes"
)
func (*BackupPolicyPrototype) isaBackupPolicyPrototype() bool {
return true
}
type BackupPolicyPrototypeIntf interface {
isaBackupPolicyPrototype() bool
}
// UnmarshalBackupPolicyPrototype unmarshals an instance of BackupPolicyPrototype from the specified map of raw messages.
func UnmarshalBackupPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyPrototype)
err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags)
if err != nil {
err = core.SDKErrorf(err, "", "match_user_tags-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "plans-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScopePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "scope-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent)
if err != nil {
err = core.SDKErrorf(err, "", "included_content-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyScope : The scope for this backup policy.
// Models which "extend" this model:
// - BackupPolicyScopeEnterpriseReference
// - BackupPolicyScopeAccountReference
type BackupPolicyScope struct {
// The CRN for this enterprise.
CRN *string `json:"crn,omitempty"`
// The unique identifier for this enterprise.
ID *string `json:"id,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type,omitempty"`
}
// Constants associated with the BackupPolicyScope.ResourceType property.
// The resource type.
const (
BackupPolicyScopeResourceTypeEnterpriseConst = "enterprise"
)
func (*BackupPolicyScope) isaBackupPolicyScope() bool {
return true
}
type BackupPolicyScopeIntf interface {
isaBackupPolicyScope() bool
}
// UnmarshalBackupPolicyScope unmarshals an instance of BackupPolicyScope from the specified map of raw messages.
func UnmarshalBackupPolicyScope(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyScope)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyScopePrototype : The scope to use for this backup policy.
//
// If unspecified, the policy will be scoped to the account.
// Models which "extend" this model:
// - BackupPolicyScopePrototypeEnterpriseIdentity
type BackupPolicyScopePrototype struct {
// The CRN for this enterprise.
CRN *string `json:"crn,omitempty"`
}
func (*BackupPolicyScopePrototype) isaBackupPolicyScopePrototype() bool {
return true
}
type BackupPolicyScopePrototypeIntf interface {
isaBackupPolicyScopePrototype() bool
}
// UnmarshalBackupPolicyScopePrototype unmarshals an instance of BackupPolicyScopePrototype from the specified map of raw messages.
func UnmarshalBackupPolicyScopePrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyScopePrototype)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BackupPolicyTargetSnapshot : BackupPolicyTargetSnapshot struct
// Models which "extend" this model:
// - BackupPolicyTargetSnapshotSnapshotReference
// - BackupPolicyTargetSnapshotShareSnapshotReference
type BackupPolicyTargetSnapshot struct {
// The CRN of this snapshot.
CRN *string `json:"crn,omitempty"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this snapshot.
Href *string `json:"href,omitempty"`
// The unique identifier for this snapshot.
ID *string `json:"id,omitempty"`
// The name for this snapshot. The name is unique across all snapshots in the region.
Name *string `json:"name,omitempty"`
// If present, this property indicates that the resource associated with this reference
// is remote and therefore may not be directly retrievable.
Remote *SnapshotRemote `json:"remote,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type,omitempty"`
}
// Constants associated with the BackupPolicyTargetSnapshot.ResourceType property.
// The resource type.
const (
BackupPolicyTargetSnapshotResourceTypeSnapshotConst = "snapshot"
)
func (*BackupPolicyTargetSnapshot) isaBackupPolicyTargetSnapshot() bool {
return true
}
type BackupPolicyTargetSnapshotIntf interface {
isaBackupPolicyTargetSnapshot() bool
}
// UnmarshalBackupPolicyTargetSnapshot unmarshals an instance of BackupPolicyTargetSnapshot from the specified map of raw messages.
func UnmarshalBackupPolicyTargetSnapshot(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BackupPolicyTargetSnapshot)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote)
if err != nil {
err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServer : BareMetalServer struct
type BareMetalServer struct {
// The total bandwidth (in megabits per second) shared across the bare metal server network attachments or bare metal
// server network interfaces.
Bandwidth *int64 `json:"bandwidth" validate:"required"`
// The resource from which this bare metal server is booted.
//
// The resources supported by this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
BootTarget BareMetalServerBootTargetIntf `json:"boot_target" validate:"required"`
// The bare metal server CPU configuration.
Cpu *BareMetalServerCpu `json:"cpu" validate:"required"`
// The date and time that the bare metal server was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The CRN for this bare metal server.
CRN *string `json:"crn" validate:"required"`
// The disks for this bare metal server, including any disks that are associated with the
// `boot_target`.
Disks []BareMetalServerDisk `json:"disks" validate:"required"`
// Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the server will fail to
// boot.
EnableSecureBoot *bool `json:"enable_secure_boot" validate:"required"`
// Firmware information for the bare metal server.
Firmware *BareMetalServerFirmware `json:"firmware" validate:"required"`
// The reasons for the current server `health_state` (if any):
// - `reservation_capacity_unavailable`: The reservation affinity pool has no
// available capacity.
// - `reservation_deleted`: The reservation affinity pool has a deleted reservation.
// - `reservation_expired`: The reservation affinity pool has an expired reservation.
// - `reservation_failed`: The reservation affinity pool has a failed reservation.
//
// See [health status reasons](https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons) for details. The
// enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
HealthReasons []BareMetalServerHealthReason `json:"health_reasons" validate:"required"`
// The health of this resource:
// - `ok`: No abnormal behavior detected
// - `degraded`: Experiencing 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 bare metal server.
Href *string `json:"href" validate:"required"`
// The unique identifier for this bare metal server.
ID *string `json:"id" validate:"required"`
// The reasons for the current `lifecycle_state` (if any).
LifecycleReasons []BareMetalServerLifecycleReason `json:"lifecycle_reasons" validate:"required"`
// The lifecycle state of the bare metal server.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The amount of memory, truncated to whole gibibytes.
Memory *int64 `json:"memory" validate:"required"`
// The name for this bare metal server. The name is unique across all bare metal servers in the region.
Name *string `json:"name" validate:"required"`
// The network attachments for this bare metal server, including the primary network attachment.
NetworkAttachments []BareMetalServerNetworkAttachmentReference `json:"network_attachments,omitempty"`
// The network interfaces for this bare metal server, including the primary network interface.
//
// If this bare metal server has network attachments, each network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface.
NetworkInterfaces []NetworkInterfaceBareMetalServerContextReference `json:"network_interfaces" validate:"required"`
// The primary network attachment for this bare metal server.
PrimaryNetworkAttachment *BareMetalServerNetworkAttachmentReference `json:"primary_network_attachment,omitempty"`
// The primary network interface for this bare metal server.
//
// If this bare metal server has network attachments, this primary network interface is
// a [read-only
// representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
// of the primary network attachment and its attached virtual network interface.
PrimaryNetworkInterface *NetworkInterfaceBareMetalServerContextReference `json:"primary_network_interface" validate:"required"`
// The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile)
// for this bare metal server.
Profile *BareMetalServerProfileReference `json:"profile" validate:"required"`
// The reservation used by this bare metal server.
// If absent, no reservation is in use.
Reservation *ReservationReference `json:"reservation,omitempty"`
ReservationAffinity *BareMetalServerReservationAffinity `json:"reservation_affinity" validate:"required"`
// The resource group for this bare metal server.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The status of this bare metal server:
// - `deleting`: server is undergoing deletion
// - `failed`: server is failed and not usable (see `status_reasons`)
// - `maintenance`: server is undergoing maintenance (not usable)
// - `pending`: server is being provisioned and not yet usable
// - `reinitializing`: server is reinitializing and not yet usable
// - `restarting`: server is restarting and not yet usable
// - `running`: server is powered on
// - `starting`: server is starting and not yet usable
// - `stopped`: server is powered off
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
// The reasons for the current status (if any).
StatusReasons []BareMetalServerStatusReason `json:"status_reasons" validate:"required"`
TrustedPlatformModule *BareMetalServerTrustedPlatformModule `json:"trusted_platform_module" validate:"required"`
// The VPC this bare metal server resides in.
VPC *VPCReference `json:"vpc" validate:"required"`
// The zone this bare metal server resides in.
Zone *ZoneReference `json:"zone" validate:"required"`
}
// Constants associated with the BareMetalServer.HealthState property.
// The health of this resource:
// - `ok`: No abnormal behavior detected
// - `degraded`: Experiencing 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 (
BareMetalServerHealthStateDegradedConst = "degraded"
BareMetalServerHealthStateFaultedConst = "faulted"
BareMetalServerHealthStateInapplicableConst = "inapplicable"
BareMetalServerHealthStateOkConst = "ok"
)
// Constants associated with the BareMetalServer.LifecycleState property.
// The lifecycle state of the bare metal server.
const (
BareMetalServerLifecycleStateDeletingConst = "deleting"
BareMetalServerLifecycleStateFailedConst = "failed"
BareMetalServerLifecycleStatePendingConst = "pending"
BareMetalServerLifecycleStateStableConst = "stable"
BareMetalServerLifecycleStateSuspendedConst = "suspended"
BareMetalServerLifecycleStateUpdatingConst = "updating"
BareMetalServerLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the BareMetalServer.ResourceType property.
// The resource type.
const (
BareMetalServerResourceTypeBareMetalServerConst = "bare_metal_server"
)
// Constants associated with the BareMetalServer.Status property.
// The status of this bare metal server:
// - `deleting`: server is undergoing deletion
// - `failed`: server is failed and not usable (see `status_reasons`)
// - `maintenance`: server is undergoing maintenance (not usable)
// - `pending`: server is being provisioned and not yet usable
// - `reinitializing`: server is reinitializing and not yet usable
// - `restarting`: server is restarting and not yet usable
// - `running`: server is powered on
// - `starting`: server is starting and not yet usable
// - `stopped`: server is powered off
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
BareMetalServerStatusDeletingConst = "deleting"
BareMetalServerStatusFailedConst = "failed"
BareMetalServerStatusMaintenanceConst = "maintenance"
BareMetalServerStatusPendingConst = "pending"
BareMetalServerStatusReinitializingConst = "reinitializing"
BareMetalServerStatusRestartingConst = "restarting"
BareMetalServerStatusRunningConst = "running"
BareMetalServerStatusStartingConst = "starting"
BareMetalServerStatusStoppedConst = "stopped"
)
// UnmarshalBareMetalServer unmarshals an instance of BareMetalServer from the specified map of raw messages.
func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServer)
err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth)
if err != nil {
err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "boot_target", &obj.BootTarget, UnmarshalBareMetalServerBootTarget)
if err != nil {
err = core.SDKErrorf(err, "", "boot_target-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "cpu", &obj.Cpu, UnmarshalBareMetalServerCpu)
if err != nil {
err = core.SDKErrorf(err, "", "cpu-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk)
if err != nil {
err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot)
if err != nil {
err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "firmware", &obj.Firmware, UnmarshalBareMetalServerFirmware)
if err != nil {
err = core.SDKErrorf(err, "", "firmware-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalBareMetalServerHealthReason)
if err != nil {
err = core.SDKErrorf(err, "", "health_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState)
if err != nil {
err = core.SDKErrorf(err, "", "health_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalBareMetalServerLifecycleReason)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "memory", &obj.Memory)
if err != nil {
err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentReference)
if err != nil {
err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceBareMetalServerContextReference)
if err != nil {
err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerNetworkAttachmentReference)
if err != nil {
err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceBareMetalServerContextReference)
if err != nil {
err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileReference)
if err != nil {
err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "reservation", &obj.Reservation, UnmarshalReservationReference)
if err != nil {
err = core.SDKErrorf(err, "", "reservation-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalBareMetalServerReservationAffinity)
if err != nil {
err = core.SDKErrorf(err, "", "reservation_affinity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBareMetalServerStatusReason)
if err != nil {
err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModule)
if err != nil {
err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerBootTarget : The resource from which this bare metal server is booted.
//
// The resources supported by this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
// Models which "extend" this model:
// - BareMetalServerBootTargetBareMetalServerDiskReference
type BareMetalServerBootTarget struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this bare metal server disk.
Href *string `json:"href,omitempty"`
// The unique identifier for this bare metal server disk.
ID *string `json:"id,omitempty"`
// The name for this bare metal server disk. The name is unique across all disks on the bare metal server.
Name *string `json:"name,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type,omitempty"`
}
// Constants associated with the BareMetalServerBootTarget.ResourceType property.
// The resource type.
const (
BareMetalServerBootTargetResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk"
)
func (*BareMetalServerBootTarget) isaBareMetalServerBootTarget() bool {
return true
}
type BareMetalServerBootTargetIntf interface {
isaBareMetalServerBootTarget() bool
}
// UnmarshalBareMetalServerBootTarget unmarshals an instance of BareMetalServerBootTarget from the specified map of raw messages.
func UnmarshalBareMetalServerBootTarget(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerBootTarget)
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerCpu : The bare metal server CPU configuration.
type BareMetalServerCpu struct {
// The CPU architecture.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Architecture *string `json:"architecture" validate:"required"`
// The total number of cores.
CoreCount *int64 `json:"core_count" validate:"required"`
// The total number of CPU sockets.
SocketCount *int64 `json:"socket_count" validate:"required"`
// The total number of hardware threads per core.
ThreadsPerCore *int64 `json:"threads_per_core" validate:"required"`
}
// Constants associated with the BareMetalServerCpu.Architecture property.
// The CPU architecture.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
BareMetalServerCpuArchitectureAmd64Const = "amd64"
BareMetalServerCpuArchitectureS390xConst = "s390x"
)
// UnmarshalBareMetalServerCpu unmarshals an instance of BareMetalServerCpu from the specified map of raw messages.
func UnmarshalBareMetalServerCpu(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerCpu)
err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture)
if err != nil {
err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "core_count", &obj.CoreCount)
if err != nil {
err = core.SDKErrorf(err, "", "core_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount)
if err != nil {
err = core.SDKErrorf(err, "", "socket_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "threads_per_core", &obj.ThreadsPerCore)
if err != nil {
err = core.SDKErrorf(err, "", "threads_per_core-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerCollection : BareMetalServerCollection struct
type BareMetalServerCollection struct {
// A page of bare metal servers.
BareMetalServers []BareMetalServer `json:"bare_metal_servers" validate:"required"`
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalBareMetalServerCollection unmarshals an instance of BareMetalServerCollection from the specified map of raw messages.
func UnmarshalBareMetalServerCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerCollection)
err = core.UnmarshalModel(m, "bare_metal_servers", &obj.BareMetalServers, UnmarshalBareMetalServer)
if err != nil {
err = core.SDKErrorf(err, "", "bare_metal_servers-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *BareMetalServerCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// BareMetalServerConsoleAccessToken : The bare metal server console access token information.
type BareMetalServerConsoleAccessToken struct {
// A URL safe single-use token used to access the console WebSocket.
AccessToken *string `json:"access_token" validate:"required"`
// The bare metal server 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 bare metal server console.
Href *string `json:"href" validate:"required"`
}
// Constants associated with the BareMetalServerConsoleAccessToken.ConsoleType property.
// The bare metal server console type for which this token may be used.
const (
BareMetalServerConsoleAccessTokenConsoleTypeSerialConst = "serial"
BareMetalServerConsoleAccessTokenConsoleTypeVncConst = "vnc"
)
// UnmarshalBareMetalServerConsoleAccessToken unmarshals an instance of BareMetalServerConsoleAccessToken from the specified map of raw messages.
func UnmarshalBareMetalServerConsoleAccessToken(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerConsoleAccessToken)
err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken)
if err != nil {
err = core.SDKErrorf(err, "", "access_token-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType)
if err != nil {
err = core.SDKErrorf(err, "", "console_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "expires_at", &obj.ExpiresAt)
if err != nil {
err = core.SDKErrorf(err, "", "expires_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "force", &obj.Force)
if err != nil {
err = core.SDKErrorf(err, "", "force-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerDisk : BareMetalServerDisk struct
type BareMetalServerDisk struct {
// The usage constraints to be matched against the requested bare metal server
// properties to determine compatibility.
//
// Only present for disks which are referenced in a bare metal server's `boot_target`
// property. The value of this property will be inherited from the source image at creation.
AllowedUse *BareMetalServerDiskAllowedUse `json:"allowed_use,omitempty"`
// The date and time that the disk was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The URL for this bare metal server disk.
Href *string `json:"href" validate:"required"`
// The unique identifier for this bare metal server disk.
ID *string `json:"id" validate:"required"`
// The disk attachment interface used:
// - `fcp`: Fiber Channel Protocol
// - `sata`: Serial Advanced Technology Attachment
// - `nvme`: Non-Volatile Memory Express
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
InterfaceType *string `json:"interface_type" validate:"required"`
// The name for this bare metal server disk. The name is unique across all disks on the bare metal server.
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 BareMetalServerDisk.InterfaceType property.
// The disk attachment interface used:
// - `fcp`: Fiber Channel Protocol
// - `sata`: Serial Advanced Technology Attachment
// - `nvme`: Non-Volatile Memory Express
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
BareMetalServerDiskInterfaceTypeFcpConst = "fcp"
BareMetalServerDiskInterfaceTypeNvmeConst = "nvme"
BareMetalServerDiskInterfaceTypeSataConst = "sata"
)
// Constants associated with the BareMetalServerDisk.ResourceType property.
// The resource type.
const (
BareMetalServerDiskResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk"
)
// UnmarshalBareMetalServerDisk unmarshals an instance of BareMetalServerDisk from the specified map of raw messages.
func UnmarshalBareMetalServerDisk(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerDisk)
err = core.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalBareMetalServerDiskAllowedUse)
if err != nil {
err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType)
if err != nil {
err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "size", &obj.Size)
if err != nil {
err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerDiskAllowedUse : BareMetalServerDiskAllowedUse struct
type BareMetalServerDiskAllowedUse struct {
// The API version with which to evaluate the expressions.
//
// If specified, the value must be between `2019-01-01` and today's date (in UTC). If unspecified, the `version` query
// parameter value will be used.
ApiVersion *string `json:"api_version" validate:"required"`
// The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in
// this disk.
//
// The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
// but does not support built-in functions and macros. In addition, the following variable is supported, corresponding
// to the `BareMetalServer` property:
// - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
BareMetalServer *string `json:"bare_metal_server" validate:"required"`
}
// UnmarshalBareMetalServerDiskAllowedUse unmarshals an instance of BareMetalServerDiskAllowedUse from the specified map of raw messages.
func UnmarshalBareMetalServerDiskAllowedUse(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerDiskAllowedUse)
err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion)
if err != nil {
err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer)
if err != nil {
err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerDiskCollection : BareMetalServerDiskCollection struct
type BareMetalServerDiskCollection struct {
// The disks for the bare metal server.
Disks []BareMetalServerDisk `json:"disks" validate:"required"`
}
// UnmarshalBareMetalServerDiskCollection unmarshals an instance of BareMetalServerDiskCollection from the specified map of raw messages.
func UnmarshalBareMetalServerDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerDiskCollection)
err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk)
if err != nil {
err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerDiskPatch : BareMetalServerDiskPatch struct
type BareMetalServerDiskPatch struct {
// The name for this bare metal server disk. The name must not be used by another disk on the bare metal server.
Name *string `json:"name,omitempty"`
}
// UnmarshalBareMetalServerDiskPatch unmarshals an instance of BareMetalServerDiskPatch from the specified map of raw messages.
func UnmarshalBareMetalServerDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerDiskPatch)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the BareMetalServerDiskPatch
func (bareMetalServerDiskPatch *BareMetalServerDiskPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(bareMetalServerDiskPatch.Name) {
_patch["name"] = bareMetalServerDiskPatch.Name
}
return
}
// BareMetalServerFirmware : Firmware information for the bare metal server.
type BareMetalServerFirmware struct {
// The type of update available.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Update *string `json:"update" validate:"required"`
}
// Constants associated with the BareMetalServerFirmware.Update property.
// The type of update available.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
BareMetalServerFirmwareUpdateNoneConst = "none"
BareMetalServerFirmwareUpdateOptionalConst = "optional"
BareMetalServerFirmwareUpdateRequiredConst = "required"
)
// UnmarshalBareMetalServerFirmware unmarshals an instance of BareMetalServerFirmware from the specified map of raw messages.
func UnmarshalBareMetalServerFirmware(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerFirmware)
err = core.UnmarshalPrimitive(m, "update", &obj.Update)
if err != nil {
err = core.SDKErrorf(err, "", "update-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerHealthReason : BareMetalServerHealthReason struct
type BareMetalServerHealthReason struct {
// A reason code for this health state.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this health state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this health state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the BareMetalServerHealthReason.Code property.
// A reason code for this health state.
const (
BareMetalServerHealthReasonCodeReservationCapacityUnavailableConst = "reservation_capacity_unavailable"
BareMetalServerHealthReasonCodeReservationDeletedConst = "reservation_deleted"
BareMetalServerHealthReasonCodeReservationExpiredConst = "reservation_expired"
BareMetalServerHealthReasonCodeReservationFailedConst = "reservation_failed"
)
// UnmarshalBareMetalServerHealthReason unmarshals an instance of BareMetalServerHealthReason from the specified map of raw messages.
func UnmarshalBareMetalServerHealthReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerHealthReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerInitialization : BareMetalServerInitialization struct
type BareMetalServerInitialization struct {
// The image the bare metal server was provisioned from.
Image *ImageReference `json:"image" validate:"required"`
// The public SSH keys used at initialization.
Keys []KeyReference `json:"keys" validate:"required"`
// The user accounts that are created at initialization. There can be multiple account types distinguished by the
// `resource_type` property.
UserAccounts []BareMetalServerInitializationUserAccountIntf `json:"user_accounts" validate:"required"`
}
// UnmarshalBareMetalServerInitialization unmarshals an instance of BareMetalServerInitialization from the specified map of raw messages.
func UnmarshalBareMetalServerInitialization(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerInitialization)
err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference)
if err != nil {
err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference)
if err != nil {
err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "user_accounts", &obj.UserAccounts, UnmarshalBareMetalServerInitializationUserAccount)
if err != nil {
err = core.SDKErrorf(err, "", "user_accounts-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerInitializationPrototype : BareMetalServerInitializationPrototype struct
type BareMetalServerInitializationPrototype struct {
// The image to be used when provisioning the bare metal server.
Image ImageIdentityIntf `json:"image" validate:"required"`
// The public SSH keys to install on the bare metal server. Keys will be made available to the bare metal server as
// cloud-init vendor data. For cloud-init enabled images, these keys will also be added as SSH authorized keys for the
// [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account).
//
// For Windows images, at least one key must be specified, and one will be selected to encrypt the administrator
// password. Keys are optional for other images, but if no keys are specified, the bare metal server will be
// inaccessible unless the specified image provides another means of access.
Keys []KeyIdentityIntf `json:"keys" validate:"required"`
// The user data to be made available when initializing the bare metal server.
UserData *string `json:"user_data,omitempty"`
}
// NewBareMetalServerInitializationPrototype : Instantiate BareMetalServerInitializationPrototype (Generic Model Constructor)
func (*VpcV1) NewBareMetalServerInitializationPrototype(image ImageIdentityIntf, keys []KeyIdentityIntf) (_model *BareMetalServerInitializationPrototype, err error) {
_model = &BareMetalServerInitializationPrototype{
Image: image,
Keys: keys,
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalBareMetalServerInitializationPrototype unmarshals an instance of BareMetalServerInitializationPrototype from the specified map of raw messages.
func UnmarshalBareMetalServerInitializationPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerInitializationPrototype)
err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData)
if err != nil {
err = core.SDKErrorf(err, "", "user_data-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerInitializationUserAccount : BareMetalServerInitializationUserAccount struct
// Models which "extend" this model:
// - BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount
type BareMetalServerInitializationUserAccount struct {
// The administrator password at initialization, encrypted using `encryption_key`, and returned base64-encoded.
EncryptedPassword *[]byte `json:"encrypted_password,omitempty"`
// The public SSH key used to encrypt the password.
EncryptionKey *KeyReference `json:"encryption_key,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type,omitempty"`
// The username for the account created at initialization.
Username *string `json:"username,omitempty"`
}
// Constants associated with the BareMetalServerInitializationUserAccount.ResourceType property.
// The resource type.
const (
BareMetalServerInitializationUserAccountResourceTypeHostUserAccountConst = "host_user_account"
)
func (*BareMetalServerInitializationUserAccount) isaBareMetalServerInitializationUserAccount() bool {
return true
}
type BareMetalServerInitializationUserAccountIntf interface {
isaBareMetalServerInitializationUserAccount() bool
}
// UnmarshalBareMetalServerInitializationUserAccount unmarshals an instance of BareMetalServerInitializationUserAccount from the specified map of raw messages.
func UnmarshalBareMetalServerInitializationUserAccount(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerInitializationUserAccount)
err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword)
if err != nil {
err = core.SDKErrorf(err, "", "encrypted_password-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference)
if err != nil {
err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "username", &obj.Username)
if err != nil {
err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerLifecycleReason : BareMetalServerLifecycleReason struct
type BareMetalServerLifecycleReason struct {
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this lifecycle state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this lifecycle state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the BareMetalServerLifecycleReason.Code property.
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
BareMetalServerLifecycleReasonCodeInternalErrorConst = "internal_error"
BareMetalServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider"
)
// UnmarshalBareMetalServerLifecycleReason unmarshals an instance of BareMetalServerLifecycleReason from the specified map of raw messages.
func UnmarshalBareMetalServerLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerLifecycleReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerNetworkAttachment : BareMetalServerNetworkAttachment struct
// Models which "extend" this model:
// - BareMetalServerNetworkAttachmentByPci
// - BareMetalServerNetworkAttachmentByVlan
type BareMetalServerNetworkAttachment struct {
// The date and time that the bare metal server network attachment was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The URL for this bare metal server network attachment.
Href *string `json:"href" validate:"required"`
// The unique identifier for this bare metal server network attachment.
ID *string `json:"id" validate:"required"`
// The network attachment's interface type:
// - `pci`: a physical PCI device which can only be created or deleted when the bare metal
// server is stopped
// - Has an `allowed_vlans` property which controls the VLANs that will be permitted
// to use the PCI attachment
// - Cannot directly use an IEEE 802.1Q tag.
// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its
// array of `allowed_vlans`.
// - Must use an IEEE 802.1Q tag.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
InterfaceType *string `json:"interface_type" validate:"required"`
// The lifecycle state of the bare metal server network attachment.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The name for this bare metal server network attachment. The name is unique across all network attachments for the
// bare metal server.
Name *string `json:"name" validate:"required"`
// The port speed for this bare metal server network attachment in Mbps.
PortSpeed *int64 `json:"port_speed" validate:"required"`
// The primary IP address of the virtual network interface for the bare metal server
// network attachment.
PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The subnet of the virtual network interface for the bare metal server network
// attachment.
Subnet *SubnetReference `json:"subnet" validate:"required"`
// The bare metal server network attachment type.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Type *string `json:"type" validate:"required"`
// The virtual network interface for this bare metal server network attachment.
VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"`
// The VLAN IDs allowed for `vlan` attachments using this PCI attachment.
AllowedVlans []int64 `json:"allowed_vlans,omitempty"`
// Indicates if the data path for the network attachment can float to another bare metal server. Can only be `true` for
// network attachments with an `interface_type` of `vlan`.
//
// If `true`, and the network detects traffic for this data path on another bare metal server in the resource group,
// the network attachment will be automatically deleted from this bare metal server and a new network attachment with
// the same `id`, `name` and `vlan` will be created on the other bare metal server. The virtual network interface for
// this network attachment will be automatically be attached to the new network attachment.
//
// For the data path to float, the other bare metal server must be in the same
// `resource_group`, and must have a network attachment with `interface_type` of `pci` with `allowed_vlans` including
// this network attachment's `vlan`.
AllowToFloat *bool `json:"allow_to_float,omitempty"`
// The IEEE 802.1Q VLAN ID that must be used for all traffic on this attachment.
Vlan *int64 `json:"vlan,omitempty"`
}
// Constants associated with the BareMetalServerNetworkAttachment.InterfaceType property.
// The network attachment's interface type:
// - `pci`: a physical PCI device which can only be created or deleted when the bare metal
// server is stopped
// - Has an `allowed_vlans` property which controls the VLANs that will be permitted
// to use the PCI attachment
// - Cannot directly use an IEEE 802.1Q tag.
// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its
// array of `allowed_vlans`.
// - Must use an IEEE 802.1Q tag.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
BareMetalServerNetworkAttachmentInterfaceTypePciConst = "pci"
BareMetalServerNetworkAttachmentInterfaceTypeVlanConst = "vlan"
)
// Constants associated with the BareMetalServerNetworkAttachment.LifecycleState property.
// The lifecycle state of the bare metal server network attachment.
const (
BareMetalServerNetworkAttachmentLifecycleStateDeletingConst = "deleting"
BareMetalServerNetworkAttachmentLifecycleStateFailedConst = "failed"
BareMetalServerNetworkAttachmentLifecycleStatePendingConst = "pending"
BareMetalServerNetworkAttachmentLifecycleStateStableConst = "stable"
BareMetalServerNetworkAttachmentLifecycleStateSuspendedConst = "suspended"
BareMetalServerNetworkAttachmentLifecycleStateUpdatingConst = "updating"
BareMetalServerNetworkAttachmentLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the BareMetalServerNetworkAttachment.ResourceType property.
// The resource type.
const (
BareMetalServerNetworkAttachmentResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment"
)
// Constants associated with the BareMetalServerNetworkAttachment.Type property.
// The bare metal server network attachment type.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
BareMetalServerNetworkAttachmentTypePrimaryConst = "primary"
BareMetalServerNetworkAttachmentTypeSecondaryConst = "secondary"
)
func (*BareMetalServerNetworkAttachment) isaBareMetalServerNetworkAttachment() bool {
return true
}
type BareMetalServerNetworkAttachmentIntf interface {
isaBareMetalServerNetworkAttachment() bool
}
// UnmarshalBareMetalServerNetworkAttachment unmarshals an instance of BareMetalServerNetworkAttachment from the specified map of raw messages.
func UnmarshalBareMetalServerNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerNetworkAttachment)
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType)
if err != nil {
err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed)
if err != nil {
err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext)
if err != nil {
err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans)
if err != nil {
err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat)
if err != nil {
err = core.SDKErrorf(err, "", "allow_to_float-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan)
if err != nil {
err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerNetworkAttachmentCollection : BareMetalServerNetworkAttachmentCollection struct
type BareMetalServerNetworkAttachmentCollection struct {
// A link to the first page of resources.
First *PageLink `json:"first" validate:"required"`
// The maximum number of resources that can be returned by the request.
Limit *int64 `json:"limit" validate:"required"`
// The network attachments for the bare metal server.
NetworkAttachments []BareMetalServerNetworkAttachmentIntf `json:"network_attachments" validate:"required"`
// A link to the next page of resources. This property is present for all pages
// except the last page.
Next *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalBareMetalServerNetworkAttachmentCollection unmarshals an instance of BareMetalServerNetworkAttachmentCollection from the specified map of raw messages.
func UnmarshalBareMetalServerNetworkAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerNetworkAttachmentCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachment)
if err != nil {
err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *BareMetalServerNetworkAttachmentCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// BareMetalServerNetworkAttachmentPatch : BareMetalServerNetworkAttachmentPatch struct
type BareMetalServerNetworkAttachmentPatch struct {
// The VLAN IDs to allow for `vlan` attachments using this PCI attachment, replacing any existing VLAN IDs. The
// specified values must include IDs for all `vlan` attachments currently using this PCI attachment.
AllowedVlans []int64 `json:"allowed_vlans,omitempty"`
// The name for this network attachment. The name must not be used by another network attachment for the bare metal
// server.
Name *string `json:"name,omitempty"`
}
// UnmarshalBareMetalServerNetworkAttachmentPatch unmarshals an instance of BareMetalServerNetworkAttachmentPatch from the specified map of raw messages.
func UnmarshalBareMetalServerNetworkAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerNetworkAttachmentPatch)
err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans)
if err != nil {
err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the BareMetalServerNetworkAttachmentPatch
func (bareMetalServerNetworkAttachmentPatch *BareMetalServerNetworkAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(bareMetalServerNetworkAttachmentPatch.AllowedVlans) {
_patch["allowed_vlans"] = bareMetalServerNetworkAttachmentPatch.AllowedVlans
}
if !core.IsNil(bareMetalServerNetworkAttachmentPatch.Name) {
_patch["name"] = bareMetalServerNetworkAttachmentPatch.Name
}
return
}
// BareMetalServerNetworkAttachmentPrototype : BareMetalServerNetworkAttachmentPrototype struct
// Models which "extend" this model:
// - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype
// - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype
type BareMetalServerNetworkAttachmentPrototype struct {
// The network attachment's interface type:
// - `pci`: a physical PCI device which can only be created or deleted when the bare metal
// server is stopped
// - Has an `allowed_vlans` property which controls the VLANs that will be permitted
// to use the PCI attachment
// - Cannot directly use an IEEE 802.1Q tag.
// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`
// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its
// array of `allowed_vlans`.
// - Must use an IEEE 802.1Q tag.
// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`.
InterfaceType *string `json:"interface_type" validate:"required"`
// The name for this bare metal server network attachment. Names must be unique within the bare metal server the
// network attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// A virtual network interface for the bare metal server network attachment. This can be
// specified using an existing virtual network interface, or a prototype object for a new
// virtual network interface.
//
// If an existing virtual network interface is specified, it must not be the target of a flow
// log collector.
VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"`
// The VLAN IDs to allow for `vlan` attachments using this PCI attachment.
AllowedVlans []int64 `json:"allowed_vlans,omitempty"`
// Indicates if the data path for the network attachment can float to another bare metal server. Can only be `true` for
// network attachments with an `interface_type` of `vlan`.
//
// If `true`, and the network detects traffic for this data path on another bare metal server in the resource group,
// the network attachment will be automatically deleted from this bare metal server and a new network attachment with
// the same `id`, `name` and `vlan` will be created on the other bare metal server. The virtual network interface for
// this network attachment will be automatically be attached to the new network attachment.
//
// For the data path to float, the other bare metal server must be in the same
// `resource_group`, and must have a network attachment with `interface_type` of `pci` with `allowed_vlans` including
// this network attachment's `vlan`.
AllowToFloat *bool `json:"allow_to_float,omitempty"`
// The IEEE 802.1Q VLAN ID that must be used for all traffic on this attachment.
Vlan *int64 `json:"vlan,omitempty"`
}
// Constants associated with the BareMetalServerNetworkAttachmentPrototype.InterfaceType property.
// The network attachment's interface type:
// - `pci`: a physical PCI device which can only be created or deleted when the bare metal
// server is stopped
// - Has an `allowed_vlans` property which controls the VLANs that will be permitted
// to use the PCI attachment
// - Cannot directly use an IEEE 802.1Q tag.
// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`
// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its
// array of `allowed_vlans`.
// - Must use an IEEE 802.1Q tag.
// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`.
const (
BareMetalServerNetworkAttachmentPrototypeInterfaceTypePciConst = "pci"
BareMetalServerNetworkAttachmentPrototypeInterfaceTypeVlanConst = "vlan"
)
func (*BareMetalServerNetworkAttachmentPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool {
return true
}
type BareMetalServerNetworkAttachmentPrototypeIntf interface {
isaBareMetalServerNetworkAttachmentPrototype() bool
}
// UnmarshalBareMetalServerNetworkAttachmentPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototype from the specified map of raw messages.
func UnmarshalBareMetalServerNetworkAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerNetworkAttachmentPrototype)
err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType)
if err != nil {
err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface)
if err != nil {
err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans)
if err != nil {
err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat)
if err != nil {
err = core.SDKErrorf(err, "", "allow_to_float-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan)
if err != nil {
err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface : A virtual network interface for the bare metal server network attachment. This can be specified using an existing
// virtual network interface, or a prototype object for a new virtual network interface.
//
// If an existing virtual network interface is specified, it must not be the target of a flow log collector.
// Models which "extend" this model:
// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext
// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity
type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface 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"`
// Indicates whether this virtual network interface will be automatically deleted when
// `target` is deleted.
AutoDelete *bool `json:"auto_delete,omitempty"`
// If `true`:
// - The VPC infrastructure performs any needed NAT operations.
// - `floating_ips` must not have more than one floating IP.
//
// If `false`:
// - Packets are passed unchanged to/from the virtual network interface,
// allowing the workload to perform any needed NAT operations.
// - `allow_ip_spoofing` must be `false`.
// - Can only be attached to a `target` with a `resource_type` of
// `bare_metal_server_network_attachment`.
EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"`
// The additional IP addresses to bind to the virtual network interface. Each item may be either a reserved IP
// identity, or a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be
// in the primary IP's subnet.
//
// If reserved IP identities are provided, the specified reserved IPs must be unbound.
//
// If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network
// interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet
// will be automatically selected and reserved.
Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"`
// The name for this virtual network interface. The name must not be used by another virtual network interface in the
// VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are
// reserved for provider-owned resources, and are not allowed.
Name *string `json:"name,omitempty"`
// The primary IP address to bind to the virtual network interface. May be either a
// reserved IP identity, or a reserved IP prototype object which will be used to create a
// new reserved IP.
//
// If a reserved IP identity is provided, the specified reserved IP must be unbound.
//
// If a reserved IP prototype object with an address is provided, the address must be
// available on the virtual network interface's subnet. If no address is specified,
// an available address on the subnet will be automatically selected and reserved.
PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"`
// The protocol state filtering mode to use for this virtual network interface. If
// `auto`, protocol state packet filtering is enabled or disabled based on the virtual network interface's `target`
// resource type:
//
// - `bare_metal_server_network_attachment`: disabled
// - `instance_network_attachment`: enabled
// - `share_mount_target`: enabled
//
// Protocol state filtering monitors each network connection flowing over this virtual network interface, and drops any
// packets that are invalid based on the current connection state and protocol. See [Protocol state filtering
// mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information.
ProtocolStateFilteringMode *string `json:"protocol_state_filtering_mode,omitempty"`
// The resource group to use for this virtual network interface. If unspecified, the
// bare metal server's resource group will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC
// for the subnet is used.
SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"`
// The associated subnet. Required if `primary_ip` does not specify a reserved IP
// identity.
Subnet SubnetIdentityIntf `json:"subnet,omitempty"`
// The unique identifier for this virtual network interface.
ID *string `json:"id,omitempty"`
// The URL for this virtual network interface.
Href *string `json:"href,omitempty"`
// The CRN for this virtual network interface.
CRN *string `json:"crn,omitempty"`
}
// Constants associated with the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface.ProtocolStateFilteringMode property.
// The protocol state filtering mode to use for this virtual network interface. If
// `auto`, protocol state packet filtering is enabled or disabled based on the virtual network interface's `target`
// resource type:
//
// - `bare_metal_server_network_attachment`: disabled
// - `instance_network_attachment`: enabled
// - `share_mount_target`: enabled
//
// Protocol state filtering monitors each network connection flowing over this virtual network interface, and drops any
// packets that are invalid based on the current connection state and protocol. See [Protocol state filtering
// mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information.
const (
BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeAutoConst = "auto"
BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeDisabledConst = "disabled"
BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeEnabledConst = "enabled"
)
func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool {
return true
}
type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf interface {
isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool
}
// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface from the specified map of raw messages.
func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface)
err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing)
if err != nil {
err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat)
if err != nil {
err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "ips-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "protocol_state_filtering_mode", &obj.ProtocolStateFilteringMode)
if err != nil {
err = core.SDKErrorf(err, "", "protocol_state_filtering_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerNetworkAttachmentReference : BareMetalServerNetworkAttachmentReference struct
type BareMetalServerNetworkAttachmentReference struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this bare metal server network attachment.
Href *string `json:"href" validate:"required"`
// The unique identifier for this bare metal server network attachment.
ID *string `json:"id" validate:"required"`
// The name for this bare metal server network attachment. The name is unique across all network attachments for the
// bare metal server.
Name *string `json:"name" validate:"required"`
// The primary IP address of the virtual network interface for the bare metal server
// network attachment.
PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The subnet of the virtual network interface for the bare metal server network
// attachment.
Subnet *SubnetReference `json:"subnet" validate:"required"`
// The virtual network interface for this bare metal server network attachment.
VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"`
}
// Constants associated with the BareMetalServerNetworkAttachmentReference.ResourceType property.
// The resource type.
const (
BareMetalServerNetworkAttachmentReferenceResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment"
)
// UnmarshalBareMetalServerNetworkAttachmentReference unmarshals an instance of BareMetalServerNetworkAttachmentReference from the specified map of raw messages.
func UnmarshalBareMetalServerNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerNetworkAttachmentReference)
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext)
if err != nil {
err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct
// Models which "extend" this model:
// - BareMetalServerNetworkInterfaceByHiperSocket
// - BareMetalServerNetworkInterfaceByPci
// - BareMetalServerNetworkInterfaceByVlan
type BareMetalServerNetworkInterface struct {
// Indicates whether source IP spoofing is allowed on this bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on
// the attached virtual network interface.
AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"`
// The date and time that the bare metal server network interface was created.
//
// If this bare metal server has network attachments, this network interface was created as a [read-only
// representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) when its corresponding
// network attachment was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// If `true`:
// - The VPC infrastructure performs any needed NAT operations.
// - `floating_ips` must not have more than one floating IP.
//
// If `false`:
// - Packets are passed unchanged to/from the bare metal server network interface,
// allowing the workload to perform any needed NAT operations.
// - `allow_ip_spoofing` must be `false`.
// - `interface_type` must not be `hipersocket`.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and infrastructure NAT is managed on
// the attached virtual network interface.
EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"`
// The floating IPs associated with this bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the floating IPs are associated
// with the attached virtual network interface.
FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"`
// The URL for this bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment.
Href *string `json:"href" validate:"required"`
// The unique identifier for this bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the identifier is that of the
// corresponding network attachment.
ID *string `json:"id" validate:"required"`
// The interface type:
// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity
// within a `s390x` based system
// - `pci`: a physical PCI device which can only be created or deleted when the bare metal
// server is stopped
// - Has an `allowed_vlans` property which controls the VLANs that will be permitted
// to use the PCI interface
// - Cannot directly use an IEEE 802.1Q tag.
// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its
// array of `allowed_vlans`.
// - Must use an IEEE 802.1Q tag.
// - Has its own security groups and does not inherit those of the PCI device through
// which traffic flows.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the interface type is that of the
// corresponding network attachment.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
InterfaceType *string `json:"interface_type" validate:"required"`
// The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value
// will be empty.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the MAC address is that of the
// attached virtual network interface.
MacAddress *string `json:"mac_address" validate:"required"`
// The name for this bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the name matches its corresponding
// network attachment.
Name *string `json:"name" validate:"required"`
// The bare metal server network interface port speed in Mbps.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the port speed is that of its
// corresponding network attachment.
PortSpeed *int64 `json:"port_speed" validate:"required"`
// The primary IP address of this bare metal server network interface.
PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The security groups targeting this bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the security groups are associated
// with the attached virtual network interface.
SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"`
// The status of the bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a read-only representation of its
// corresponding network attachment and its attached virtual network interface, and the status is [computed from
// them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients).
Status *string `json:"status" validate:"required"`
// The associated subnet.
Subnet *SubnetReference `json:"subnet" validate:"required"`
// The bare metal server network interface type.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the type is that of its
// corresponding network attachment.
Type *string `json:"type" validate:"required"`
// The VLAN IDs allowed for `vlan` interfaces using this PCI interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the VLAN IDs match the
// `allow_vlans` of the corresponding network attachment.
AllowedVlans []int64 `json:"allowed_vlans,omitempty"`
// Indicates if the data path for the network interface can float to another bare metal server. Can only be `true` for
// network interfaces with an `interface_type` of `vlan`.
//
// If `true`, and the network detects traffic for this data path on another bare metal server in the resource group,
// the network interface will be automatically deleted from this bare metal server and a new network interface with the
// same `id`, `name` and `vlan` will be created on the other bare metal server.
//
// For the data path to float, the other bare metal server must be in the same
// `resource_group`, and must have a network interface with `interface_type` of `pci` with `allowed_vlans` including
// this network interface's `vlan`.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the value of this property matches
// that of the `allow_to_float` property of the corresponding network attachment.
AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"`
// The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the VLAN ID matches the `vlan` of
// the corresponding network attachment.
Vlan *int64 `json:"vlan,omitempty"`
}
// Constants associated with the BareMetalServerNetworkInterface.InterfaceType property.
// The interface type:
// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity
// within a `s390x` based system
// - `pci`: a physical PCI device which can only be created or deleted when the bare metal
// server is stopped
// - Has an `allowed_vlans` property which controls the VLANs that will be permitted
// to use the PCI interface
// - Cannot directly use an IEEE 802.1Q tag.
// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its
// array of `allowed_vlans`.
// - Must use an IEEE 802.1Q tag.
// - Has its own security groups and does not inherit those of the PCI device through
// which traffic flows.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the interface type is that of the
// corresponding network attachment.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
BareMetalServerNetworkInterfaceInterfaceTypeHipersocketConst = "hipersocket"
BareMetalServerNetworkInterfaceInterfaceTypePciConst = "pci"
BareMetalServerNetworkInterfaceInterfaceTypeVlanConst = "vlan"
)
// Constants associated with the BareMetalServerNetworkInterface.ResourceType property.
// The resource type.
const (
BareMetalServerNetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface"
)
// Constants associated with the BareMetalServerNetworkInterface.Status property.
// The status of the bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a read-only representation of its
// corresponding network attachment and its attached virtual network interface, and the status is [computed from
// them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients).
const (
BareMetalServerNetworkInterfaceStatusAvailableConst = "available"
BareMetalServerNetworkInterfaceStatusDeletingConst = "deleting"
BareMetalServerNetworkInterfaceStatusFailedConst = "failed"
BareMetalServerNetworkInterfaceStatusPendingConst = "pending"
)
// Constants associated with the BareMetalServerNetworkInterface.Type property.
// The bare metal server network interface type.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the type is that of its
// corresponding network attachment.
const (
BareMetalServerNetworkInterfaceTypePrimaryConst = "primary"
BareMetalServerNetworkInterfaceTypeSecondaryConst = "secondary"
)
func (*BareMetalServerNetworkInterface) isaBareMetalServerNetworkInterface() bool {
return true
}
type BareMetalServerNetworkInterfaceIntf interface {
isaBareMetalServerNetworkInterface() bool
}
// UnmarshalBareMetalServerNetworkInterface unmarshals an instance of BareMetalServerNetworkInterface from the specified map of raw messages.
func UnmarshalBareMetalServerNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) {
// Retrieve discriminator value to determine correct "subclass".
var discValue string
err = core.UnmarshalPrimitive(m, "interface_type", &discValue)
if err != nil {
errMsg := fmt.Sprintf("error unmarshalling discriminator property 'interface_type': %s", err.Error())
err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo())
return
}
if discValue == "" {
err = core.SDKErrorf(err, "required discriminator property 'interface_type' not found in JSON object", "missing-discriminator", common.GetComponentInfo())
return
}
if discValue == "hipersocket" {
err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByHiperSocket)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfaceByHiperSocket-error", common.GetComponentInfo())
}
} else if discValue == "pci" {
err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByPci)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfaceByPci-error", common.GetComponentInfo())
}
} else if discValue == "vlan" {
err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByVlan)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfaceByVlan-error", common.GetComponentInfo())
}
} else {
errMsg := fmt.Sprintf("unrecognized value for discriminator property 'interface_type': %s", discValue)
err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo())
}
return
}
// BareMetalServerNetworkInterfaceCollection : BareMetalServerNetworkInterfaceCollection struct
type BareMetalServerNetworkInterfaceCollection struct {
// A link to the first page of resources.
First *PageLink `json:"first" validate:"required"`
// The maximum number of resources that can be returned by the request.
Limit *int64 `json:"limit" validate:"required"`
// The network interfaces for the bare metal server.
NetworkInterfaces []BareMetalServerNetworkInterfaceIntf `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalBareMetalServerNetworkInterfaceCollection unmarshals an instance of BareMetalServerNetworkInterfaceCollection from the specified map of raw messages.
func UnmarshalBareMetalServerNetworkInterfaceCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerNetworkInterfaceCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface)
if err != nil {
err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *BareMetalServerNetworkInterfaceCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// BareMetalServerNetworkInterfacePatch : BareMetalServerNetworkInterfacePatch struct
type BareMetalServerNetworkInterfacePatch struct {
// Indicates whether source IP spoofing is allowed on this bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on
// the attached virtual network interface.
AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"`
// The VLAN IDs to allow for `vlan` interfaces using this PCI interface, replacing any existing VLAN IDs. The specified
// values must include IDs for all `vlan` interfaces currently using this PCI interface.
AllowedVlans []int64 `json:"allowed_vlans,omitempty"`
// If `true`:
// - The VPC infrastructure performs any needed NAT operations.
// - `floating_ips` must not have more than one floating IP.
//
// If `false`:
// - Packets are passed unchanged to/from the bare metal server network interface,
// allowing the workload to perform any needed NAT operations.
// - `allow_ip_spoofing` must be `false`.
// - `interface_type` must not be `hipersocket`.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and infrastructure NAT is managed on
// the attached virtual network interface.
EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"`
// The name for this bare metal server network interface. The name must not be used by another network interface on the
// bare metal server.
Name *string `json:"name,omitempty"`
}
// UnmarshalBareMetalServerNetworkInterfacePatch unmarshals an instance of BareMetalServerNetworkInterfacePatch from the specified map of raw messages.
func UnmarshalBareMetalServerNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerNetworkInterfacePatch)
err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing)
if err != nil {
err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans)
if err != nil {
err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat)
if err != nil {
err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the BareMetalServerNetworkInterfacePatch
func (bareMetalServerNetworkInterfacePatch *BareMetalServerNetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(bareMetalServerNetworkInterfacePatch.AllowIPSpoofing) {
_patch["allow_ip_spoofing"] = bareMetalServerNetworkInterfacePatch.AllowIPSpoofing
}
if !core.IsNil(bareMetalServerNetworkInterfacePatch.AllowedVlans) {
_patch["allowed_vlans"] = bareMetalServerNetworkInterfacePatch.AllowedVlans
}
if !core.IsNil(bareMetalServerNetworkInterfacePatch.EnableInfrastructureNat) {
_patch["enable_infrastructure_nat"] = bareMetalServerNetworkInterfacePatch.EnableInfrastructureNat
}
if !core.IsNil(bareMetalServerNetworkInterfacePatch.Name) {
_patch["name"] = bareMetalServerNetworkInterfacePatch.Name
}
return
}
// BareMetalServerNetworkInterfacePrototype : BareMetalServerNetworkInterfacePrototype struct
// Models which "extend" this model:
// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype
// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype
// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype
type BareMetalServerNetworkInterfacePrototype struct {
// Indicates whether source IP spoofing is allowed on this bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on
// the attached virtual network interface.
AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"`
// If `true`:
// - The VPC infrastructure performs any needed NAT operations.
// - `floating_ips` must not have more than one floating IP.
//
// If `false`:
// - Packets are passed unchanged to/from the bare metal server network interface,
// allowing the workload to perform any needed NAT operations.
// - `allow_ip_spoofing` must be `false`.
// - `interface_type` must not be `hipersocket`.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and infrastructure NAT is managed on
// the attached virtual network interface.
EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"`
// The interface type:
// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity
// within a `s390x` based system
// - Not supported on bare metal servers with a `cpu.architecture` of `amd64`
// - `pci`: a physical PCI device which can only be created or deleted when the bare metal
// server is stopped
// - Has an `allowed_vlans` property which controls the VLANs that will be permitted
// to use the PCI interface
// - Cannot directly use an IEEE 802.1Q tag.
// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`
// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its
// array of `allowed_vlans`.
// - Must use an IEEE 802.1Q tag.
// - Has its own security groups and does not inherit those of the PCI device through
// which traffic flows.
// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`.
InterfaceType *string `json:"interface_type" validate:"required"`
// The name for this bare metal server network interface. The name must not be used by another network interface on the
// bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The primary IP address to bind to the bare metal server network interface. This can be
// specified using an existing reserved IP, or a prototype object for a new reserved IP.
//
// If an existing reserved IP or a prototype object with an address is specified, it must
// be available on the bare metal server network interface's subnet. Otherwise, an
// available address on the subnet will be automatically selected and reserved.
PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"`
// The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security
// group is used.
SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"`
// The associated subnet.
Subnet SubnetIdentityIntf `json:"subnet" validate:"required"`
// The VLAN IDs to allow for `vlan` interfaces using this PCI interface.
AllowedVlans []int64 `json:"allowed_vlans,omitempty"`
// Indicates if the data path for the network interface can float to another bare metal server. Can only be `true` for
// network interfaces with an `interface_type` of `vlan`.
//
// If `true`, and the network detects traffic for this data path on another bare metal server in the resource group,
// the network interface will be automatically deleted from this bare metal server and a new network interface with the
// same `id`, `name` and `vlan` will be created on the other bare metal server.
//
// For the data path to float, the other bare metal server must be in the same
// `resource_group`, and must have a network interface with `interface_type` of `pci` with `allowed_vlans` including
// this network interface's `vlan`.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the value of this property matches
// that of the `allow_to_float` property of the corresponding network attachment.
AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"`
// The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the VLAN ID matches the `vlan` of
// the corresponding network attachment.
Vlan *int64 `json:"vlan,omitempty"`
}
// Constants associated with the BareMetalServerNetworkInterfacePrototype.InterfaceType property.
// The interface type:
// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity
// within a `s390x` based system
// - Not supported on bare metal servers with a `cpu.architecture` of `amd64`
// - `pci`: a physical PCI device which can only be created or deleted when the bare metal
// server is stopped
// - Has an `allowed_vlans` property which controls the VLANs that will be permitted
// to use the PCI interface
// - Cannot directly use an IEEE 802.1Q tag.
// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`
// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its
// array of `allowed_vlans`.
// - Must use an IEEE 802.1Q tag.
// - Has its own security groups and does not inherit those of the PCI device through
// which traffic flows.
// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`.
const (
BareMetalServerNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket"
BareMetalServerNetworkInterfacePrototypeInterfaceTypePciConst = "pci"
BareMetalServerNetworkInterfacePrototypeInterfaceTypeVlanConst = "vlan"
)
func (*BareMetalServerNetworkInterfacePrototype) isaBareMetalServerNetworkInterfacePrototype() bool {
return true
}
type BareMetalServerNetworkInterfacePrototypeIntf interface {
isaBareMetalServerNetworkInterfacePrototype() bool
}
// UnmarshalBareMetalServerNetworkInterfacePrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototype from the specified map of raw messages.
func UnmarshalBareMetalServerNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) {
// Retrieve discriminator value to determine correct "subclass".
var discValue string
err = core.UnmarshalPrimitive(m, "interface_type", &discValue)
if err != nil {
errMsg := fmt.Sprintf("error unmarshalling discriminator property 'interface_type': %s", err.Error())
err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo())
return
}
if discValue == "" {
err = core.SDKErrorf(err, "required discriminator property 'interface_type' not found in JSON object", "missing-discriminator", common.GetComponentInfo())
return
}
if discValue == "hipersocket" {
err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype-error", common.GetComponentInfo())
}
} else if discValue == "pci" {
err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype-error", common.GetComponentInfo())
}
} else if discValue == "vlan" {
err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype-error", common.GetComponentInfo())
}
} else {
errMsg := fmt.Sprintf("unrecognized value for discriminator property 'interface_type': %s", discValue)
err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo())
}
return
}
// BareMetalServerPatch : BareMetalServerPatch struct
type BareMetalServerPatch struct {
// The total bandwidth (in megabits per second) shared across the bare metal server's network interfaces. The specified
// value must match one of the bandwidth values in the bare metal server's profile.
Bandwidth *int64 `json:"bandwidth,omitempty"`
// Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the bare metal server
// will fail to boot.
//
// For `enable_secure_boot` to be changed, the bare metal server `status` must be
// `stopped`.
EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"`
// The name for this bare metal server. The name must not be used by another bare metal server in the region. Changing
// the name will not affect the system hostname.
Name *string `json:"name,omitempty"`
ReservationAffinity *BareMetalServerReservationAffinityPatch `json:"reservation_affinity,omitempty"`
TrustedPlatformModule *BareMetalServerTrustedPlatformModulePatch `json:"trusted_platform_module,omitempty"`
}
// UnmarshalBareMetalServerPatch unmarshals an instance of BareMetalServerPatch from the specified map of raw messages.
func UnmarshalBareMetalServerPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerPatch)
err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth)
if err != nil {
err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot)
if err != nil {
err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalBareMetalServerReservationAffinityPatch)
if err != nil {
err = core.SDKErrorf(err, "", "reservation_affinity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePatch)
if err != nil {
err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the BareMetalServerPatch
func (bareMetalServerPatch *BareMetalServerPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(bareMetalServerPatch.Bandwidth) {
_patch["bandwidth"] = bareMetalServerPatch.Bandwidth
}
if !core.IsNil(bareMetalServerPatch.EnableSecureBoot) {
_patch["enable_secure_boot"] = bareMetalServerPatch.EnableSecureBoot
}
if !core.IsNil(bareMetalServerPatch.Name) {
_patch["name"] = bareMetalServerPatch.Name
}
if !core.IsNil(bareMetalServerPatch.ReservationAffinity) {
_patch["reservation_affinity"] = bareMetalServerPatch.ReservationAffinity.asPatch()
}
if !core.IsNil(bareMetalServerPatch.TrustedPlatformModule) {
_patch["trusted_platform_module"] = bareMetalServerPatch.TrustedPlatformModule.asPatch()
}
return
}
// BareMetalServerPrimaryNetworkAttachmentPrototype : BareMetalServerPrimaryNetworkAttachmentPrototype struct
// Models which "extend" this model:
// - BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype
type BareMetalServerPrimaryNetworkAttachmentPrototype struct {
// The network attachment's interface type:
// - `pci`: a physical PCI device which can only be created or deleted when the bare metal
// server is stopped
// - Has an `allowed_vlans` property which controls the VLANs that will be permitted
// to use the PCI attachment
// - Cannot directly use an IEEE 802.1Q tag.
// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`.
InterfaceType *string `json:"interface_type,omitempty"`
// The name for this bare metal server network attachment. Names must be unique within the bare metal server the
// network attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// A virtual network interface for the bare metal server network attachment. This can be
// specified using an existing virtual network interface, or a prototype object for a new
// virtual network interface.
//
// If an existing virtual network interface is specified, it must not be the target of a flow
// log collector.
VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"`
// The VLAN IDs to allow for `vlan` attachments using this PCI attachment.
AllowedVlans []int64 `json:"allowed_vlans,omitempty"`
}
// Constants associated with the BareMetalServerPrimaryNetworkAttachmentPrototype.InterfaceType property.
// The network attachment's interface type:
// - `pci`: a physical PCI device which can only be created or deleted when the bare metal
// server is stopped
// - Has an `allowed_vlans` property which controls the VLANs that will be permitted
// to use the PCI attachment
// - Cannot directly use an IEEE 802.1Q tag.
// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`.
const (
BareMetalServerPrimaryNetworkAttachmentPrototypeInterfaceTypePciConst = "pci"
)
func (*BareMetalServerPrimaryNetworkAttachmentPrototype) isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool {
return true
}
type BareMetalServerPrimaryNetworkAttachmentPrototypeIntf interface {
isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool
}
// UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype unmarshals an instance of BareMetalServerPrimaryNetworkAttachmentPrototype from the specified map of raw messages.
func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerPrimaryNetworkAttachmentPrototype)
err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType)
if err != nil {
err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface)
if err != nil {
err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans)
if err != nil {
err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerPrimaryNetworkInterfacePrototype : BareMetalServerPrimaryNetworkInterfacePrototype struct
type BareMetalServerPrimaryNetworkInterfacePrototype struct {
// Indicates whether source IP spoofing is allowed on this bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on
// the attached virtual network interface.
AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"`
// The VLAN IDs allowed for `vlan` interfaces using this PCI interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the VLAN IDs match the
// `allow_vlans` of the corresponding network attachment.
AllowedVlans []int64 `json:"allowed_vlans,omitempty"`
// If `true`:
// - The VPC infrastructure performs any needed NAT operations.
// - `floating_ips` must not have more than one floating IP.
//
// If `false`:
// - Packets are passed unchanged to/from the bare metal server network interface,
// allowing the workload to perform any needed NAT operations.
// - `allow_ip_spoofing` must be `false`.
// - `interface_type` must not be `hipersocket`.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and infrastructure NAT is managed on
// the attached virtual network interface.
EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"`
// The interface type:
// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity
// within a `s390x` based system.
// - Not supported on bare metal servers with a `cpu.architecture` of `amd64`
// - `pci`: a physical PCI device which can only be created or deleted when the bare metal
// server is stopped
// - Has an `allowed_vlans` property which controls the VLANs that will be permitted
// to use the PCI interface
// - Cannot directly use an IEEE 802.1Q tag.
// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`.
InterfaceType *string `json:"interface_type,omitempty"`
// The name for this bare metal server network interface. The name must not be used by another network interface on the
// bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The primary IP address to bind to the bare metal server network interface. This can be
// specified using an existing reserved IP, or a prototype object for a new reserved IP.
//
// If an existing reserved IP or a prototype object with an address is specified, it must
// be available on the bare metal server network interface's subnet. Otherwise, an
// available address on the subnet will be automatically selected and reserved.
PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"`
// The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security
// group is used.
SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"`
// The associated subnet.
Subnet SubnetIdentityIntf `json:"subnet" validate:"required"`
}
// Constants associated with the BareMetalServerPrimaryNetworkInterfacePrototype.InterfaceType property.
// The interface type:
// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity
// within a `s390x` based system.
// - Not supported on bare metal servers with a `cpu.architecture` of `amd64`
// - `pci`: a physical PCI device which can only be created or deleted when the bare metal
// server is stopped
// - Has an `allowed_vlans` property which controls the VLANs that will be permitted
// to use the PCI interface
// - Cannot directly use an IEEE 802.1Q tag.
// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`.
const (
BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket"
BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypePciConst = "pci"
)
// NewBareMetalServerPrimaryNetworkInterfacePrototype : Instantiate BareMetalServerPrimaryNetworkInterfacePrototype (Generic Model Constructor)
func (*VpcV1) NewBareMetalServerPrimaryNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *BareMetalServerPrimaryNetworkInterfacePrototype, err error) {
_model = &BareMetalServerPrimaryNetworkInterfacePrototype{
Subnet: subnet,
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype unmarshals an instance of BareMetalServerPrimaryNetworkInterfacePrototype from the specified map of raw messages.
func UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerPrimaryNetworkInterfacePrototype)
err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing)
if err != nil {
err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans)
if err != nil {
err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat)
if err != nil {
err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType)
if err != nil {
err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfile : BareMetalServerProfile struct
type BareMetalServerProfile struct {
Bandwidth BareMetalServerProfileBandwidthIntf `json:"bandwidth" validate:"required"`
// The console type configuration for a bare metal server with this profile.
ConsoleTypes *BareMetalServerProfileConsoleTypes `json:"console_types" validate:"required"`
CpuArchitecture *BareMetalServerProfileCpuArchitecture `json:"cpu_architecture" validate:"required"`
CpuCoreCount BareMetalServerProfileCpuCoreCountIntf `json:"cpu_core_count" validate:"required"`
CpuSocketCount BareMetalServerProfileCpuSocketCountIntf `json:"cpu_socket_count" validate:"required"`
// The disks for a bare metal server with this profile.
Disks []BareMetalServerProfileDisk `json:"disks" validate:"required"`
// The product family this bare metal server profile belongs to.
Family *string `json:"family" validate:"required"`
// The URL for this bare metal server profile.
Href *string `json:"href" validate:"required"`
Memory BareMetalServerProfileMemoryIntf `json:"memory" validate:"required"`
// The name for this bare metal server profile.
Name *string `json:"name" validate:"required"`
NetworkAttachmentCount BareMetalServerProfileNetworkAttachmentCountIntf `json:"network_attachment_count" validate:"required"`
NetworkInterfaceCount BareMetalServerProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"`
OsArchitecture *BareMetalServerProfileOsArchitecture `json:"os_architecture" validate:"required"`
ReservationTerms *BareMetalServerProfileReservationTerms `json:"reservation_terms" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The supported trusted platform module modes for this bare metal server profile.
SupportedTrustedPlatformModuleModes *BareMetalServerProfileSupportedTrustedPlatformModuleModes `json:"supported_trusted_platform_module_modes" validate:"required"`
// Indicates whether this profile supports virtual network interfaces.
VirtualNetworkInterfacesSupported *BareMetalServerProfileVirtualNetworkInterfacesSupported `json:"virtual_network_interfaces_supported" validate:"required"`
}
// Constants associated with the BareMetalServerProfile.ResourceType property.
// The resource type.
const (
BareMetalServerProfileResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile"
)
// UnmarshalBareMetalServerProfile unmarshals an instance of BareMetalServerProfile from the specified map of raw messages.
func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfile)
err = core.UnmarshalModel(m, "bandwidth", &obj.Bandwidth, UnmarshalBareMetalServerProfileBandwidth)
if err != nil {
err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "console_types", &obj.ConsoleTypes, UnmarshalBareMetalServerProfileConsoleTypes)
if err != nil {
err = core.SDKErrorf(err, "", "console_types-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "cpu_architecture", &obj.CpuArchitecture, UnmarshalBareMetalServerProfileCpuArchitecture)
if err != nil {
err = core.SDKErrorf(err, "", "cpu_architecture-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "cpu_core_count", &obj.CpuCoreCount, UnmarshalBareMetalServerProfileCpuCoreCount)
if err != nil {
err = core.SDKErrorf(err, "", "cpu_core_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "cpu_socket_count", &obj.CpuSocketCount, UnmarshalBareMetalServerProfileCpuSocketCount)
if err != nil {
err = core.SDKErrorf(err, "", "cpu_socket_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerProfileDisk)
if err != nil {
err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "family", &obj.Family)
if err != nil {
err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory)
if err != nil {
err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_attachment_count", &obj.NetworkAttachmentCount, UnmarshalBareMetalServerProfileNetworkAttachmentCount)
if err != nil {
err = core.SDKErrorf(err, "", "network_attachment_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalBareMetalServerProfileNetworkInterfaceCount)
if err != nil {
err = core.SDKErrorf(err, "", "network_interface_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalBareMetalServerProfileOsArchitecture)
if err != nil {
err = core.SDKErrorf(err, "", "os_architecture-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "reservation_terms", &obj.ReservationTerms, UnmarshalBareMetalServerProfileReservationTerms)
if err != nil {
err = core.SDKErrorf(err, "", "reservation_terms-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "supported_trusted_platform_module_modes", &obj.SupportedTrustedPlatformModuleModes, UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes)
if err != nil {
err = core.SDKErrorf(err, "", "supported_trusted_platform_module_modes-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "virtual_network_interfaces_supported", &obj.VirtualNetworkInterfacesSupported, UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported)
if err != nil {
err = core.SDKErrorf(err, "", "virtual_network_interfaces_supported-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileBandwidth : BareMetalServerProfileBandwidth struct
// Models which "extend" this model:
// - BareMetalServerProfileBandwidthFixed
// - BareMetalServerProfileBandwidthRange
// - BareMetalServerProfileBandwidthEnum
// - BareMetalServerProfileBandwidthDependent
type BareMetalServerProfileBandwidth 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 BareMetalServerProfileBandwidth.Type property.
// The type for this profile field.
const (
BareMetalServerProfileBandwidthTypeFixedConst = "fixed"
)
func (*BareMetalServerProfileBandwidth) isaBareMetalServerProfileBandwidth() bool {
return true
}
type BareMetalServerProfileBandwidthIntf interface {
isaBareMetalServerProfileBandwidth() bool
}
// UnmarshalBareMetalServerProfileBandwidth unmarshals an instance of BareMetalServerProfileBandwidth from the specified map of raw messages.
func UnmarshalBareMetalServerProfileBandwidth(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileBandwidth)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileCpuArchitecture : BareMetalServerProfileCpuArchitecture struct
type BareMetalServerProfileCpuArchitecture struct {
// The type for this profile field.
Type *string `json:"type" validate:"required"`
// The CPU architecture for a bare metal server with this profile.
Value *string `json:"value" validate:"required"`
}
// Constants associated with the BareMetalServerProfileCpuArchitecture.Type property.
// The type for this profile field.
const (
BareMetalServerProfileCpuArchitectureTypeFixedConst = "fixed"
)
// Constants associated with the BareMetalServerProfileCpuArchitecture.Value property.
// The CPU architecture for a bare metal server with this profile.
const (
BareMetalServerProfileCpuArchitectureValueAmd64Const = "amd64"
BareMetalServerProfileCpuArchitectureValueS390xConst = "s390x"
)
// UnmarshalBareMetalServerProfileCpuArchitecture unmarshals an instance of BareMetalServerProfileCpuArchitecture from the specified map of raw messages.
func UnmarshalBareMetalServerProfileCpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileCpuArchitecture)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileCpuCoreCount : BareMetalServerProfileCpuCoreCount struct
// Models which "extend" this model:
// - BareMetalServerProfileCpuCoreCountFixed
// - BareMetalServerProfileCpuCoreCountRange
// - BareMetalServerProfileCpuCoreCountEnum
// - BareMetalServerProfileCpuCoreCountDependent
type BareMetalServerProfileCpuCoreCount 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 BareMetalServerProfileCpuCoreCount.Type property.
// The type for this profile field.
const (
BareMetalServerProfileCpuCoreCountTypeFixedConst = "fixed"
)
func (*BareMetalServerProfileCpuCoreCount) isaBareMetalServerProfileCpuCoreCount() bool {
return true
}
type BareMetalServerProfileCpuCoreCountIntf interface {
isaBareMetalServerProfileCpuCoreCount() bool
}
// UnmarshalBareMetalServerProfileCpuCoreCount unmarshals an instance of BareMetalServerProfileCpuCoreCount from the specified map of raw messages.
func UnmarshalBareMetalServerProfileCpuCoreCount(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileCpuCoreCount)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileCpuSocketCount : BareMetalServerProfileCpuSocketCount struct
// Models which "extend" this model:
// - BareMetalServerProfileCpuSocketCountFixed
// - BareMetalServerProfileCpuSocketCountRange
// - BareMetalServerProfileCpuSocketCountEnum
// - BareMetalServerProfileCpuSocketCountDependent
type BareMetalServerProfileCpuSocketCount 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 BareMetalServerProfileCpuSocketCount.Type property.
// The type for this profile field.
const (
BareMetalServerProfileCpuSocketCountTypeFixedConst = "fixed"
)
func (*BareMetalServerProfileCpuSocketCount) isaBareMetalServerProfileCpuSocketCount() bool {
return true
}
type BareMetalServerProfileCpuSocketCountIntf interface {
isaBareMetalServerProfileCpuSocketCount() bool
}
// UnmarshalBareMetalServerProfileCpuSocketCount unmarshals an instance of BareMetalServerProfileCpuSocketCount from the specified map of raw messages.
func UnmarshalBareMetalServerProfileCpuSocketCount(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileCpuSocketCount)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileCollection : BareMetalServerProfileCollection struct
type BareMetalServerProfileCollection struct {
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of bare metal server profiles.
Profiles []BareMetalServerProfile `json:"profiles" validate:"required"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalBareMetalServerProfileCollection unmarshals an instance of BareMetalServerProfileCollection from the specified map of raw messages.
func UnmarshalBareMetalServerProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalBareMetalServerProfile)
if err != nil {
err = core.SDKErrorf(err, "", "profiles-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *BareMetalServerProfileCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// BareMetalServerProfileConsoleTypes : The console type configuration for a bare metal server with this profile.
type BareMetalServerProfileConsoleTypes struct {
// The type for this profile field.
Type *string `json:"type" validate:"required"`
// The console types for a bare metal server with this profile.
Values []string `json:"values" validate:"required"`
}
// Constants associated with the BareMetalServerProfileConsoleTypes.Type property.
// The type for this profile field.
const (
BareMetalServerProfileConsoleTypesTypeEnumConst = "enum"
)
// Constants associated with the BareMetalServerProfileConsoleTypes.Values property.
// A console type.
const (
BareMetalServerProfileConsoleTypesValuesSerialConst = "serial"
BareMetalServerProfileConsoleTypesValuesVncConst = "vnc"
)
// UnmarshalBareMetalServerProfileConsoleTypes unmarshals an instance of BareMetalServerProfileConsoleTypes from the specified map of raw messages.
func UnmarshalBareMetalServerProfileConsoleTypes(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileConsoleTypes)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileDisk : Disks provided by this profile.
type BareMetalServerProfileDisk struct {
Quantity BareMetalServerProfileDiskQuantityIntf `json:"quantity" validate:"required"`
Size BareMetalServerProfileDiskSizeIntf `json:"size" validate:"required"`
SupportedInterfaceTypes *BareMetalServerProfileDiskSupportedInterfaces `json:"supported_interface_types" validate:"required"`
}
// UnmarshalBareMetalServerProfileDisk unmarshals an instance of BareMetalServerProfileDisk from the specified map of raw messages.
func UnmarshalBareMetalServerProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileDisk)
err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalBareMetalServerProfileDiskQuantity)
if err != nil {
err = core.SDKErrorf(err, "", "quantity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalBareMetalServerProfileDiskSize)
if err != nil {
err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalBareMetalServerProfileDiskSupportedInterfaces)
if err != nil {
err = core.SDKErrorf(err, "", "supported_interface_types-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileDiskQuantity : BareMetalServerProfileDiskQuantity struct
// Models which "extend" this model:
// - BareMetalServerProfileDiskQuantityFixed
// - BareMetalServerProfileDiskQuantityRange
// - BareMetalServerProfileDiskQuantityEnum
// - BareMetalServerProfileDiskQuantityDependent
type BareMetalServerProfileDiskQuantity 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 BareMetalServerProfileDiskQuantity.Type property.
// The type for this profile field.
const (
BareMetalServerProfileDiskQuantityTypeFixedConst = "fixed"
)
func (*BareMetalServerProfileDiskQuantity) isaBareMetalServerProfileDiskQuantity() bool {
return true
}
type BareMetalServerProfileDiskQuantityIntf interface {
isaBareMetalServerProfileDiskQuantity() bool
}
// UnmarshalBareMetalServerProfileDiskQuantity unmarshals an instance of BareMetalServerProfileDiskQuantity from the specified map of raw messages.
func UnmarshalBareMetalServerProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileDiskQuantity)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileDiskSize : BareMetalServerProfileDiskSize struct
// Models which "extend" this model:
// - BareMetalServerProfileDiskSizeFixed
// - BareMetalServerProfileDiskSizeRange
// - BareMetalServerProfileDiskSizeEnum
// - BareMetalServerProfileDiskSizeDependent
type BareMetalServerProfileDiskSize 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 BareMetalServerProfileDiskSize.Type property.
// The type for this profile field.
const (
BareMetalServerProfileDiskSizeTypeFixedConst = "fixed"
)
func (*BareMetalServerProfileDiskSize) isaBareMetalServerProfileDiskSize() bool {
return true
}
type BareMetalServerProfileDiskSizeIntf interface {
isaBareMetalServerProfileDiskSize() bool
}
// UnmarshalBareMetalServerProfileDiskSize unmarshals an instance of BareMetalServerProfileDiskSize from the specified map of raw messages.
func UnmarshalBareMetalServerProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileDiskSize)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileDiskSupportedInterfaces : BareMetalServerProfileDiskSupportedInterfaces struct
type BareMetalServerProfileDiskSupportedInterfaces struct {
// The default value for this profile field.
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 BareMetalServerProfileDiskSupportedInterfaces.Default property.
// The default value for this profile field.
const (
BareMetalServerProfileDiskSupportedInterfacesDefaultFcpConst = "fcp"
BareMetalServerProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme"
BareMetalServerProfileDiskSupportedInterfacesDefaultSataConst = "sata"
)
// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Type property.
// The type for this profile field.
const (
BareMetalServerProfileDiskSupportedInterfacesTypeEnumConst = "enum"
)
// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Values property.
// The disk attachment interface used:
// - `fcp`: Fiber Channel Protocol
// - `sata`: Serial Advanced Technology Attachment
// - `nvme`: Non-Volatile Memory Express
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
BareMetalServerProfileDiskSupportedInterfacesValuesFcpConst = "fcp"
BareMetalServerProfileDiskSupportedInterfacesValuesNvmeConst = "nvme"
BareMetalServerProfileDiskSupportedInterfacesValuesSataConst = "sata"
)
// UnmarshalBareMetalServerProfileDiskSupportedInterfaces unmarshals an instance of BareMetalServerProfileDiskSupportedInterfaces from the specified map of raw messages.
func UnmarshalBareMetalServerProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileDiskSupportedInterfaces)
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileIdentity : Identifies a bare metal server profile by a unique property.
// Models which "extend" this model:
// - BareMetalServerProfileIdentityByName
// - BareMetalServerProfileIdentityByHref
type BareMetalServerProfileIdentity struct {
// The name for this bare metal server profile.
Name *string `json:"name,omitempty"`
// The URL for this bare metal server profile.
Href *string `json:"href,omitempty"`
}
func (*BareMetalServerProfileIdentity) isaBareMetalServerProfileIdentity() bool {
return true
}
type BareMetalServerProfileIdentityIntf interface {
isaBareMetalServerProfileIdentity() bool
}
// UnmarshalBareMetalServerProfileIdentity unmarshals an instance of BareMetalServerProfileIdentity from the specified map of raw messages.
func UnmarshalBareMetalServerProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileIdentity)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileMemory : BareMetalServerProfileMemory struct
// Models which "extend" this model:
// - BareMetalServerProfileMemoryFixed
// - BareMetalServerProfileMemoryRange
// - BareMetalServerProfileMemoryEnum
// - BareMetalServerProfileMemoryDependent
type BareMetalServerProfileMemory 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 BareMetalServerProfileMemory.Type property.
// The type for this profile field.
const (
BareMetalServerProfileMemoryTypeFixedConst = "fixed"
)
func (*BareMetalServerProfileMemory) isaBareMetalServerProfileMemory() bool {
return true
}
type BareMetalServerProfileMemoryIntf interface {
isaBareMetalServerProfileMemory() bool
}
// UnmarshalBareMetalServerProfileMemory unmarshals an instance of BareMetalServerProfileMemory from the specified map of raw messages.
func UnmarshalBareMetalServerProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileMemory)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileNetworkAttachmentCount : BareMetalServerProfileNetworkAttachmentCount struct
// Models which "extend" this model:
// - BareMetalServerProfileNetworkAttachmentCountRange
// - BareMetalServerProfileNetworkAttachmentCountDependent
type BareMetalServerProfileNetworkAttachmentCount struct {
// 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 type for this profile field.
Type *string `json:"type,omitempty"`
}
// Constants associated with the BareMetalServerProfileNetworkAttachmentCount.Type property.
// The type for this profile field.
const (
BareMetalServerProfileNetworkAttachmentCountTypeRangeConst = "range"
)
func (*BareMetalServerProfileNetworkAttachmentCount) isaBareMetalServerProfileNetworkAttachmentCount() bool {
return true
}
type BareMetalServerProfileNetworkAttachmentCountIntf interface {
isaBareMetalServerProfileNetworkAttachmentCount() bool
}
// UnmarshalBareMetalServerProfileNetworkAttachmentCount unmarshals an instance of BareMetalServerProfileNetworkAttachmentCount from the specified map of raw messages.
func UnmarshalBareMetalServerProfileNetworkAttachmentCount(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileNetworkAttachmentCount)
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileNetworkInterfaceCount : BareMetalServerProfileNetworkInterfaceCount struct
// Models which "extend" this model:
// - BareMetalServerProfileNetworkInterfaceCountRange
// - BareMetalServerProfileNetworkInterfaceCountDependent
type BareMetalServerProfileNetworkInterfaceCount struct {
// 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 type for this profile field.
Type *string `json:"type,omitempty"`
}
// Constants associated with the BareMetalServerProfileNetworkInterfaceCount.Type property.
// The type for this profile field.
const (
BareMetalServerProfileNetworkInterfaceCountTypeRangeConst = "range"
)
func (*BareMetalServerProfileNetworkInterfaceCount) isaBareMetalServerProfileNetworkInterfaceCount() bool {
return true
}
type BareMetalServerProfileNetworkInterfaceCountIntf interface {
isaBareMetalServerProfileNetworkInterfaceCount() bool
}
// UnmarshalBareMetalServerProfileNetworkInterfaceCount unmarshals an instance of BareMetalServerProfileNetworkInterfaceCount from the specified map of raw messages.
func UnmarshalBareMetalServerProfileNetworkInterfaceCount(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileNetworkInterfaceCount)
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileOsArchitecture : BareMetalServerProfileOsArchitecture struct
type BareMetalServerProfileOsArchitecture struct {
// The default OS architecture for a bare metal server 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 a bare metal server with this profile.
Values []string `json:"values" validate:"required"`
}
// Constants associated with the BareMetalServerProfileOsArchitecture.Type property.
// The type for this profile field.
const (
BareMetalServerProfileOsArchitectureTypeEnumConst = "enum"
)
// UnmarshalBareMetalServerProfileOsArchitecture unmarshals an instance of BareMetalServerProfileOsArchitecture from the specified map of raw messages.
func UnmarshalBareMetalServerProfileOsArchitecture(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileOsArchitecture)
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileReference : BareMetalServerProfileReference struct
type BareMetalServerProfileReference struct {
// The URL for this bare metal server profile.
Href *string `json:"href" validate:"required"`
// The name for this bare metal server profile.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the BareMetalServerProfileReference.ResourceType property.
// The resource type.
const (
BareMetalServerProfileReferenceResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile"
)
// UnmarshalBareMetalServerProfileReference unmarshals an instance of BareMetalServerProfileReference from the specified map of raw messages.
func UnmarshalBareMetalServerProfileReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileReference)
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileReservationTerms : BareMetalServerProfileReservationTerms struct
type BareMetalServerProfileReservationTerms struct {
// The type for this profile field.
Type *string `json:"type" validate:"required"`
// The supported committed use terms for a reservation using this profile.
Values []string `json:"values" validate:"required"`
}
// Constants associated with the BareMetalServerProfileReservationTerms.Type property.
// The type for this profile field.
const (
BareMetalServerProfileReservationTermsTypeEnumConst = "enum"
)
// Constants associated with the BareMetalServerProfileReservationTerms.Values property.
const (
BareMetalServerProfileReservationTermsValuesOneYearConst = "one_year"
BareMetalServerProfileReservationTermsValuesThreeYearConst = "three_year"
)
// UnmarshalBareMetalServerProfileReservationTerms unmarshals an instance of BareMetalServerProfileReservationTerms from the specified map of raw messages.
func UnmarshalBareMetalServerProfileReservationTerms(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileReservationTerms)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileSupportedTrustedPlatformModuleModes : The supported trusted platform module modes for this bare metal server profile.
type BareMetalServerProfileSupportedTrustedPlatformModuleModes struct {
// The default trusted platform module for a bare metal server with this profile.
Default *string `json:"default,omitempty"`
// The type for this profile field.
Type *string `json:"type" validate:"required"`
// The supported trusted platform module modes.
Values []string `json:"values" validate:"required"`
}
// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Default property.
// The default trusted platform module for a bare metal server with this profile.
const (
BareMetalServerProfileSupportedTrustedPlatformModuleModesDefaultDisabledConst = "disabled"
BareMetalServerProfileSupportedTrustedPlatformModuleModesDefaultTpm2Const = "tpm_2"
)
// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Type property.
// The type for this profile field.
const (
BareMetalServerProfileSupportedTrustedPlatformModuleModesTypeEnumConst = "enum"
)
// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Values property.
// The trusted platform module (TPM) mode:
// - `disabled`: No TPM functionality
// - `tpm_2`: TPM 2.0
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesDisabledConst = "disabled"
BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2"
)
// UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes unmarshals an instance of BareMetalServerProfileSupportedTrustedPlatformModuleModes from the specified map of raw messages.
func UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileSupportedTrustedPlatformModuleModes)
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerProfileVirtualNetworkInterfacesSupported : Indicates whether this profile supports virtual network interfaces.
type BareMetalServerProfileVirtualNetworkInterfacesSupported 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 BareMetalServerProfileVirtualNetworkInterfacesSupported.Type property.
// The type for this profile field.
const (
BareMetalServerProfileVirtualNetworkInterfacesSupportedTypeFixedConst = "fixed"
)
// UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported unmarshals an instance of BareMetalServerProfileVirtualNetworkInterfacesSupported from the specified map of raw messages.
func UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerProfileVirtualNetworkInterfacesSupported)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerPrototype : BareMetalServerPrototype struct
// Models which "extend" this model:
// - BareMetalServerPrototypeBareMetalServerByNetworkAttachment
// - BareMetalServerPrototypeBareMetalServerByNetworkInterface
type BareMetalServerPrototype struct {
// The total bandwidth (in megabits per second) shared across the bare metal server's network interfaces. The specified
// value must match one of the bandwidth values in the bare metal server's profile. If unspecified, the default value
// from the profile will be used.
Bandwidth *int64 `json:"bandwidth,omitempty"`
// Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the server will fail to
// boot.
EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"`
Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"`
// The name for this bare metal server. The name must not be used by another bare metal server in the region. If
// unspecified, the name will be a hyphenated list of randomly-selected words.
//
// The system hostname will be based on this name.
Name *string `json:"name,omitempty"`
// The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile)
// to use for this bare metal server.
Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"`
ReservationAffinity *BareMetalServerReservationAffinityPrototype `json:"reservation_affinity,omitempty"`
// The resource group to use. If unspecified, the account's [default resource
// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"`
// The VPC this bare metal server will reside in.
//
// If specified, it must match the VPC for the subnets that the network attachments or
// network interfaces of the bare metal server are attached to.
VPC VPCIdentityIntf `json:"vpc,omitempty"`
// The zone this bare metal server will reside in.
Zone ZoneIdentityIntf `json:"zone" validate:"required"`
// The additional network attachments to create for the bare metal server.
NetworkAttachments []BareMetalServerNetworkAttachmentPrototypeIntf `json:"network_attachments,omitempty"`
// The primary network attachment to create for the bare metal server.
PrimaryNetworkAttachment BareMetalServerPrimaryNetworkAttachmentPrototypeIntf `json:"primary_network_attachment,omitempty"`
// The additional bare metal server network interfaces to create.
NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"`
// The primary bare metal server network interface to create.
PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_network_interface,omitempty"`
}
func (*BareMetalServerPrototype) isaBareMetalServerPrototype() bool {
return true
}
type BareMetalServerPrototypeIntf interface {
isaBareMetalServerPrototype() bool
}
// UnmarshalBareMetalServerPrototype unmarshals an instance of BareMetalServerPrototype from the specified map of raw messages.
func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerPrototype)
err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth)
if err != nil {
err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot)
if err != nil {
err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "initialization-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalBareMetalServerReservationAffinityPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "reservation_affinity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerReservationAffinity : BareMetalServerReservationAffinity struct
type BareMetalServerReservationAffinity struct {
// The reservation affinity policy to use for this bare metal server:
// - `disabled`: Reservations will not be used
// - `manual`: Reservations in `pool` are available for use
// - `automatic`: Any reservations with an `affinity_policy` of `automatic`
// that have the same `profile` and `zone` as this bare metal server
// are available for use.
Policy *string `json:"policy" validate:"required"`
// The pool of reservations available for use by this bare metal server when the `policy` is `manual`. This must be
// empty if the `policy` is `automatic` or
// `disabled`.
Pool []ReservationReference `json:"pool" validate:"required"`
}
// Constants associated with the BareMetalServerReservationAffinity.Policy property.
// The reservation affinity policy to use for this bare metal server:
// - `disabled`: Reservations will not be used
// - `manual`: Reservations in `pool` are available for use
// - `automatic`: Any reservations with an `affinity_policy` of `automatic`
// that have the same `profile` and `zone` as this bare metal server
// are available for use.
const (
BareMetalServerReservationAffinityPolicyAutomaticConst = "automatic"
BareMetalServerReservationAffinityPolicyDisabledConst = "disabled"
BareMetalServerReservationAffinityPolicyManualConst = "manual"
)
// UnmarshalBareMetalServerReservationAffinity unmarshals an instance of BareMetalServerReservationAffinity from the specified map of raw messages.
func UnmarshalBareMetalServerReservationAffinity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerReservationAffinity)
err = core.UnmarshalPrimitive(m, "policy", &obj.Policy)
if err != nil {
err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationReference)
if err != nil {
err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerReservationAffinityPatch : BareMetalServerReservationAffinityPatch struct
type BareMetalServerReservationAffinityPatch struct {
// The reservation affinity policy to use for this bare metal server:
// - `disabled`: Reservations will not be used
// - `manual`: Reservations in `pool` will be available for use
// - `automatic`: Any reservations with an `affinity_policy` of `automatic` that have the
// same `profile` and `zone` as this bare metal server are available for use.
Policy *string `json:"policy,omitempty"`
// The pool of reservations available for use by this bare metal server, replacing the existing pool of reservations.
//
// Specified reservations must have a `status` of `active`, and have the same
// `profile` and `zone` as this bare metal server.
//
// If `policy` is `manual`, `pool` must have one reservation. If `policy` is `disabled` or `automatic`, `pool` must be
// empty. If `policy` is `manual`, the `pool` must contain a reservation with available capacity.
Pool []ReservationIdentityIntf `json:"pool,omitempty"`
}
// Constants associated with the BareMetalServerReservationAffinityPatch.Policy property.
// The reservation affinity policy to use for this bare metal server:
// - `disabled`: Reservations will not be used
// - `manual`: Reservations in `pool` will be available for use
// - `automatic`: Any reservations with an `affinity_policy` of `automatic` that have the
// same `profile` and `zone` as this bare metal server are available for use.
const (
BareMetalServerReservationAffinityPatchPolicyAutomaticConst = "automatic"
BareMetalServerReservationAffinityPatchPolicyDisabledConst = "disabled"
BareMetalServerReservationAffinityPatchPolicyManualConst = "manual"
)
// UnmarshalBareMetalServerReservationAffinityPatch unmarshals an instance of BareMetalServerReservationAffinityPatch from the specified map of raw messages.
func UnmarshalBareMetalServerReservationAffinityPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerReservationAffinityPatch)
err = core.UnmarshalPrimitive(m, "policy", &obj.Policy)
if err != nil {
err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the BareMetalServerReservationAffinityPatch
func (bareMetalServerReservationAffinityPatch *BareMetalServerReservationAffinityPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(bareMetalServerReservationAffinityPatch.Policy) {
_patch["policy"] = bareMetalServerReservationAffinityPatch.Policy
}
if !core.IsNil(bareMetalServerReservationAffinityPatch.Pool) {
var poolPatches []map[string]interface{}
for _, pool := range bareMetalServerReservationAffinityPatch.Pool {
poolPatches = append(poolPatches, pool.asPatch())
}
_patch["pool"] = poolPatches
}
return
}
// BareMetalServerReservationAffinityPrototype : BareMetalServerReservationAffinityPrototype struct
type BareMetalServerReservationAffinityPrototype struct {
// The reservation affinity policy to use for this bare metal server:
// - `disabled`: Reservations will not be used
// - `manual`: Reservations in `pool` will be available for use
// - `automatic`: Any reservations with an `affinity_policy` of `automatic` that have the
// same `profile` and `zone` as this bare metal server are available for use.
//
// The policy will default to `manual` if `pool` is not empty. Otherwise the policy will default to `automatic`.
Policy *string `json:"policy,omitempty"`
// The pool of reservations available for use by this bare metal server.
//
// Specified reservations must have a `status` of `active`, and have the same `profile` and `zone` as this bare metal
// server.
//
// If `policy` is `manual`, `pool` must have one reservation. If `policy` is `disabled` or `automatic`, `pool` must be
// empty. If `policy` is `manual`, the `pool` must contain a reservation with available capacity.
Pool []ReservationIdentityIntf `json:"pool,omitempty"`
}
// Constants associated with the BareMetalServerReservationAffinityPrototype.Policy property.
// The reservation affinity policy to use for this bare metal server:
// - `disabled`: Reservations will not be used
// - `manual`: Reservations in `pool` will be available for use
// - `automatic`: Any reservations with an `affinity_policy` of `automatic` that have the
// same `profile` and `zone` as this bare metal server are available for use.
//
// The policy will default to `manual` if `pool` is not empty. Otherwise the policy will default to `automatic`.
const (
BareMetalServerReservationAffinityPrototypePolicyAutomaticConst = "automatic"
BareMetalServerReservationAffinityPrototypePolicyDisabledConst = "disabled"
BareMetalServerReservationAffinityPrototypePolicyManualConst = "manual"
)
// UnmarshalBareMetalServerReservationAffinityPrototype unmarshals an instance of BareMetalServerReservationAffinityPrototype from the specified map of raw messages.
func UnmarshalBareMetalServerReservationAffinityPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerReservationAffinityPrototype)
err = core.UnmarshalPrimitive(m, "policy", &obj.Policy)
if err != nil {
err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerStatusReason : BareMetalServerStatusReason struct
type BareMetalServerStatusReason struct {
// The status reason code:
// - `cannot_reinitialize`: An error occurred while reinitializing bare metal server
// - `cannot_start`: Failed to start due to an internal error
// - `cannot_start_capacity`: Insufficient capacity within the selected zone
// - `cannot_start_compute`: An error occurred while allocating compute resources
// - `cannot_start_ip_address`: An error occurred while allocating an IP address
// - `cannot_start_network`: An error occurred while allocating network resources
// - `cannot_update_firmware`: An error occurred while updating bare metal server firmware
// - `cannot_start_reservation_capacity`: Failed to start because the reservation has
// insufficient capacity
// - `cannot_start_reservation_expired`: Failed to start because the reservation has
// expired
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the status reason.
Message *string `json:"message" validate:"required"`
// A link to documentation about this status reason.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the BareMetalServerStatusReason.Code property.
// The status reason code:
// - `cannot_reinitialize`: An error occurred while reinitializing bare metal server
// - `cannot_start`: Failed to start due to an internal error
// - `cannot_start_capacity`: Insufficient capacity within the selected zone
// - `cannot_start_compute`: An error occurred while allocating compute resources
// - `cannot_start_ip_address`: An error occurred while allocating an IP address
// - `cannot_start_network`: An error occurred while allocating network resources
// - `cannot_update_firmware`: An error occurred while updating bare metal server firmware
// - `cannot_start_reservation_capacity`: Failed to start because the reservation has
// insufficient capacity
// - `cannot_start_reservation_expired`: Failed to start because the reservation has
// expired
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
BareMetalServerStatusReasonCodeCannotReinitializeConst = "cannot_reinitialize"
BareMetalServerStatusReasonCodeCannotStartConst = "cannot_start"
BareMetalServerStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity"
BareMetalServerStatusReasonCodeCannotStartComputeConst = "cannot_start_compute"
BareMetalServerStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address"
BareMetalServerStatusReasonCodeCannotStartNetworkConst = "cannot_start_network"
BareMetalServerStatusReasonCodeCannotStartReservationCapacityConst = "cannot_start_reservation_capacity"
BareMetalServerStatusReasonCodeCannotStartReservationExpiredConst = "cannot_start_reservation_expired"
BareMetalServerStatusReasonCodeCannotUpdateFirmwareConst = "cannot_update_firmware"
)
// UnmarshalBareMetalServerStatusReason unmarshals an instance of BareMetalServerStatusReason from the specified map of raw messages.
func UnmarshalBareMetalServerStatusReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerStatusReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerTrustedPlatformModule : BareMetalServerTrustedPlatformModule struct
type BareMetalServerTrustedPlatformModule struct {
// Indicates whether the trusted platform module is enabled.
Enabled *bool `json:"enabled" validate:"required"`
// The trusted platform module (TPM) mode:
// - `disabled`: No TPM functionality
// - `tpm_2`: TPM 2.0
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Mode *string `json:"mode" validate:"required"`
// The supported trusted platform module modes.
SupportedModes []string `json:"supported_modes" validate:"required"`
}
// Constants associated with the BareMetalServerTrustedPlatformModule.Mode property.
// The trusted platform module (TPM) mode:
// - `disabled`: No TPM functionality
// - `tpm_2`: TPM 2.0
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
BareMetalServerTrustedPlatformModuleModeDisabledConst = "disabled"
BareMetalServerTrustedPlatformModuleModeTpm2Const = "tpm_2"
)
// Constants associated with the BareMetalServerTrustedPlatformModule.SupportedModes property.
// The trusted platform module (TPM) mode:
// - `disabled`: No TPM functionality
// - `tpm_2`: TPM 2.0
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
BareMetalServerTrustedPlatformModuleSupportedModesDisabledConst = "disabled"
BareMetalServerTrustedPlatformModuleSupportedModesTpm2Const = "tpm_2"
)
// UnmarshalBareMetalServerTrustedPlatformModule unmarshals an instance of BareMetalServerTrustedPlatformModule from the specified map of raw messages.
func UnmarshalBareMetalServerTrustedPlatformModule(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerTrustedPlatformModule)
err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled)
if err != nil {
err = core.SDKErrorf(err, "", "enabled-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "mode", &obj.Mode)
if err != nil {
err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes)
if err != nil {
err = core.SDKErrorf(err, "", "supported_modes-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// BareMetalServerTrustedPlatformModulePatch : BareMetalServerTrustedPlatformModulePatch struct
type BareMetalServerTrustedPlatformModulePatch struct {
// The trusted platform module mode to use. The specified value must be listed in the bare metal server's
// `supported_modes`.
//
// For the trusted platform module mode to be changed, the bare metal server `status` must be `stopped`.
Mode *string `json:"mode,omitempty"`
}
// Constants associated with the BareMetalServerTrustedPlatformModulePatch.Mode property.
// The trusted platform module mode to use. The specified value must be listed in the bare metal server's
// `supported_modes`.
//
// For the trusted platform module mode to be changed, the bare metal server `status` must be `stopped`.
const (
BareMetalServerTrustedPlatformModulePatchModeDisabledConst = "disabled"
BareMetalServerTrustedPlatformModulePatchModeTpm2Const = "tpm_2"
)
// UnmarshalBareMetalServerTrustedPlatformModulePatch unmarshals an instance of BareMetalServerTrustedPlatformModulePatch from the specified map of raw messages.
func UnmarshalBareMetalServerTrustedPlatformModulePatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerTrustedPlatformModulePatch)
err = core.UnmarshalPrimitive(m, "mode", &obj.Mode)
if err != nil {
err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the BareMetalServerTrustedPlatformModulePatch
func (bareMetalServerTrustedPlatformModulePatch *BareMetalServerTrustedPlatformModulePatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(bareMetalServerTrustedPlatformModulePatch.Mode) {
_patch["mode"] = bareMetalServerTrustedPlatformModulePatch.Mode
}
return
}
// BareMetalServerTrustedPlatformModulePrototype : BareMetalServerTrustedPlatformModulePrototype struct
type BareMetalServerTrustedPlatformModulePrototype struct {
// The trusted platform module mode to use. The specified value must be listed in the bare metal server profile's
// `supported_trusted_platform_module_modes`.
//
// If unspecified, the default trusted platform module mode from the profile will be used.
Mode *string `json:"mode,omitempty"`
}
// Constants associated with the BareMetalServerTrustedPlatformModulePrototype.Mode property.
// The trusted platform module mode to use. The specified value must be listed in the bare metal server profile's
// `supported_trusted_platform_module_modes`.
//
// If unspecified, the default trusted platform module mode from the profile will be used.
const (
BareMetalServerTrustedPlatformModulePrototypeModeDisabledConst = "disabled"
BareMetalServerTrustedPlatformModulePrototypeModeTpm2Const = "tpm_2"
)
// UnmarshalBareMetalServerTrustedPlatformModulePrototype unmarshals an instance of BareMetalServerTrustedPlatformModulePrototype from the specified map of raw messages.
func UnmarshalBareMetalServerTrustedPlatformModulePrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(BareMetalServerTrustedPlatformModulePrototype)
err = core.UnmarshalPrimitive(m, "mode", &obj.Mode)
if err != nil {
err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// CatalogOfferingIdentity : Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a unique
// property.
// Models which "extend" this model:
// - CatalogOfferingIdentityCatalogOfferingByCRN
type CatalogOfferingIdentity struct {
// The CRN for this
// [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering.
CRN *string `json:"crn,omitempty"`
}
func (*CatalogOfferingIdentity) isaCatalogOfferingIdentity() bool {
return true
}
type CatalogOfferingIdentityIntf interface {
isaCatalogOfferingIdentity() bool
}
// UnmarshalCatalogOfferingIdentity unmarshals an instance of CatalogOfferingIdentity from the specified map of raw messages.
func UnmarshalCatalogOfferingIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(CatalogOfferingIdentity)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// CatalogOfferingVersionIdentity : Identifies a version of a
// [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a unique property.
// Models which "extend" this model:
// - CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN
type CatalogOfferingVersionIdentity struct {
// The CRN for this version of a
// [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering.
CRN *string `json:"crn,omitempty"`
}
func (*CatalogOfferingVersionIdentity) isaCatalogOfferingVersionIdentity() bool {
return true
}
type CatalogOfferingVersionIdentityIntf interface {
isaCatalogOfferingVersionIdentity() bool
}
// UnmarshalCatalogOfferingVersionIdentity unmarshals an instance of CatalogOfferingVersionIdentity from the specified map of raw messages.
func UnmarshalCatalogOfferingVersionIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(CatalogOfferingVersionIdentity)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// CatalogOfferingVersionPlanIdentity : Identifies a catalog offering version's billing plan by a unique property.
// Models which "extend" this model:
// - CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN
type CatalogOfferingVersionPlanIdentity struct {
// The CRN for this
// [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering version's billing plan.
CRN *string `json:"crn,omitempty"`
}
func (*CatalogOfferingVersionPlanIdentity) isaCatalogOfferingVersionPlanIdentity() bool {
return true
}
type CatalogOfferingVersionPlanIdentityIntf interface {
isaCatalogOfferingVersionPlanIdentity() bool
}
// UnmarshalCatalogOfferingVersionPlanIdentity unmarshals an instance of CatalogOfferingVersionPlanIdentity from the specified map of raw messages.
func UnmarshalCatalogOfferingVersionPlanIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(CatalogOfferingVersionPlanIdentity)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// CatalogOfferingVersionPlanReference : CatalogOfferingVersionPlanReference struct
type CatalogOfferingVersionPlanReference struct {
// The CRN for this
// [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering version's billing plan.
CRN *string `json:"crn" validate:"required"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
}
// UnmarshalCatalogOfferingVersionPlanReference unmarshals an instance of CatalogOfferingVersionPlanReference from the specified map of raw messages.
func UnmarshalCatalogOfferingVersionPlanReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(CatalogOfferingVersionPlanReference)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// CatalogOfferingVersionReference : CatalogOfferingVersionReference struct
type CatalogOfferingVersionReference struct {
// The CRN for this version of a
// [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering.
CRN *string `json:"crn" validate:"required"`
}
// UnmarshalCatalogOfferingVersionReference unmarshals an instance of CatalogOfferingVersionReference from the specified map of raw messages.
func UnmarshalCatalogOfferingVersionReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(CatalogOfferingVersionReference)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
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
asPatch() map[string]interface{}
}
// 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 {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the CertificateInstanceIdentity
func (certificateInstanceIdentity *CertificateInstanceIdentity) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(certificateInstanceIdentity.CRN) {
_patch["crn"] = certificateInstanceIdentity.CRN
}
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 {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// CheckVPNGatewayConnectionsLocalCIDROptions : The CheckVPNGatewayConnectionsLocalCIDR options.
type CheckVPNGatewayConnectionsLocalCIDROptions struct {
// The VPN gateway identifier.
VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="`
// The VPN gateway connection identifier.
ID *string `json:"id" validate:"required,ne="`
// The IP address range in CIDR block notation.
CIDR *string `json:"cidr" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCheckVPNGatewayConnectionsLocalCIDROptions : Instantiate CheckVPNGatewayConnectionsLocalCIDROptions
func (*VpcV1) NewCheckVPNGatewayConnectionsLocalCIDROptions(vpnGatewayID string, id string, cidr string) *CheckVPNGatewayConnectionsLocalCIDROptions {
return &CheckVPNGatewayConnectionsLocalCIDROptions{
VPNGatewayID: core.StringPtr(vpnGatewayID),
ID: core.StringPtr(id),
CIDR: core.StringPtr(cidr),
}
}
// SetVPNGatewayID : Allow user to set VPNGatewayID
func (_options *CheckVPNGatewayConnectionsLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionsLocalCIDROptions {
_options.VPNGatewayID = core.StringPtr(vpnGatewayID)
return _options
}
// SetID : Allow user to set ID
func (_options *CheckVPNGatewayConnectionsLocalCIDROptions) SetID(id string) *CheckVPNGatewayConnectionsLocalCIDROptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetCIDR : Allow user to set CIDR
func (_options *CheckVPNGatewayConnectionsLocalCIDROptions) SetCIDR(cidr string) *CheckVPNGatewayConnectionsLocalCIDROptions {
_options.CIDR = core.StringPtr(cidr)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CheckVPNGatewayConnectionsLocalCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionsLocalCIDROptions {
options.Headers = param
return options
}
// CheckVPNGatewayConnectionsPeerCIDROptions : The CheckVPNGatewayConnectionsPeerCIDR options.
type CheckVPNGatewayConnectionsPeerCIDROptions struct {
// The VPN gateway identifier.
VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="`
// The VPN gateway connection identifier.
ID *string `json:"id" validate:"required,ne="`
// The IP address range in CIDR block notation.
CIDR *string `json:"cidr" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCheckVPNGatewayConnectionsPeerCIDROptions : Instantiate CheckVPNGatewayConnectionsPeerCIDROptions
func (*VpcV1) NewCheckVPNGatewayConnectionsPeerCIDROptions(vpnGatewayID string, id string, cidr string) *CheckVPNGatewayConnectionsPeerCIDROptions {
return &CheckVPNGatewayConnectionsPeerCIDROptions{
VPNGatewayID: core.StringPtr(vpnGatewayID),
ID: core.StringPtr(id),
CIDR: core.StringPtr(cidr),
}
}
// SetVPNGatewayID : Allow user to set VPNGatewayID
func (_options *CheckVPNGatewayConnectionsPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionsPeerCIDROptions {
_options.VPNGatewayID = core.StringPtr(vpnGatewayID)
return _options
}
// SetID : Allow user to set ID
func (_options *CheckVPNGatewayConnectionsPeerCIDROptions) SetID(id string) *CheckVPNGatewayConnectionsPeerCIDROptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetCIDR : Allow user to set CIDR
func (_options *CheckVPNGatewayConnectionsPeerCIDROptions) SetCIDR(cidr string) *CheckVPNGatewayConnectionsPeerCIDROptions {
_options.CIDR = core.StringPtr(cidr)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CheckVPNGatewayConnectionsPeerCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionsPeerCIDROptions {
options.Headers = param
return options
}
// CloudObjectStorageBucketIdentity : Identifies a Cloud Object Storage bucket by a unique property.
// Models which "extend" this model:
// - CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName
// - CloudObjectStorageBucketIdentityByCRN
type CloudObjectStorageBucketIdentity struct {
// The globally unique name of this Cloud Object Storage bucket.
Name *string `json:"name,omitempty"`
// The CRN of this Cloud Object Storage bucket.
CRN *string `json:"crn,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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// CloudObjectStorageBucketReference : CloudObjectStorageBucketReference struct
type CloudObjectStorageBucketReference struct {
// The CRN of this Cloud Object Storage bucket.
CRN *string `json:"crn" validate:"required"`
// The globally unique name of this Cloud Object Storage 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, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// CloudObjectStorageObjectReference : CloudObjectStorageObjectReference struct
type CloudObjectStorageObjectReference struct {
// The name of this Cloud Object Storage object. Names are unique within a Cloud Object Storage bucket.
Name *string `json:"name" validate:"required"`
}
// UnmarshalCloudObjectStorageObjectReference unmarshals an instance of CloudObjectStorageObjectReference from the specified map of raw messages.
func UnmarshalCloudObjectStorageObjectReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(CloudObjectStorageObjectReference)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetwork : ClusterNetwork struct
type ClusterNetwork struct {
// The date and time that the cluster network was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The CRN for this cluster network.
CRN *string `json:"crn" validate:"required"`
// The URL for this cluster network.
Href *string `json:"href" validate:"required"`
// The unique identifier for this cluster network.
ID *string `json:"id" validate:"required"`
// The reasons for the current `lifecycle_state` (if any).
LifecycleReasons []ClusterNetworkLifecycleReason `json:"lifecycle_reasons" validate:"required"`
// The lifecycle state of the cluster network.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The name for this cluster network. The name must not be used by another cluster network in the region.
Name *string `json:"name" validate:"required"`
// The profile for this cluster network.
Profile *ClusterNetworkProfileReference `json:"profile" validate:"required"`
// The resource group for this cluster network.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The IP address ranges available for subnets for this cluster network.
SubnetPrefixes []ClusterNetworkSubnetPrefix `json:"subnet_prefixes" validate:"required"`
// The VPC this cluster network resides in.
VPC *VPCReference `json:"vpc" validate:"required"`
// The zone this cluster network resides in.
Zone *ZoneReference `json:"zone" validate:"required"`
}
// Constants associated with the ClusterNetwork.LifecycleState property.
// The lifecycle state of the cluster network.
const (
ClusterNetworkLifecycleStateDeletingConst = "deleting"
ClusterNetworkLifecycleStateFailedConst = "failed"
ClusterNetworkLifecycleStatePendingConst = "pending"
ClusterNetworkLifecycleStateStableConst = "stable"
ClusterNetworkLifecycleStateSuspendedConst = "suspended"
ClusterNetworkLifecycleStateUpdatingConst = "updating"
ClusterNetworkLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the ClusterNetwork.ResourceType property.
// The resource type.
const (
ClusterNetworkResourceTypeClusterNetworkConst = "cluster_network"
)
// UnmarshalClusterNetwork unmarshals an instance of ClusterNetwork from the specified map of raw messages.
func UnmarshalClusterNetwork(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetwork)
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalClusterNetworkLifecycleReason)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalClusterNetworkProfileReference)
if err != nil {
err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet_prefixes", &obj.SubnetPrefixes, UnmarshalClusterNetworkSubnetPrefix)
if err != nil {
err = core.SDKErrorf(err, "", "subnet_prefixes-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkCollection : ClusterNetworkCollection struct
type ClusterNetworkCollection struct {
// A page of cluster networks.
ClusterNetworks []ClusterNetwork `json:"cluster_networks" validate:"required"`
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalClusterNetworkCollection unmarshals an instance of ClusterNetworkCollection from the specified map of raw messages.
func UnmarshalClusterNetworkCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkCollection)
err = core.UnmarshalModel(m, "cluster_networks", &obj.ClusterNetworks, UnmarshalClusterNetwork)
if err != nil {
err = core.SDKErrorf(err, "", "cluster_networks-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ClusterNetworkCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ClusterNetworkInterface : The associated cluster network subnet.
type ClusterNetworkInterface struct {
// Indicates whether source IP spoofing is allowed on this cluster network interface. If `false`, source IP spoofing is
// prevented on this cluster network interface. If `true`, source IP spoofing is allowed on this cluster network
// interface.
AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"`
// Indicates whether this cluster network interface will be automatically deleted when `target` is deleted.
AutoDelete *bool `json:"auto_delete" validate:"required"`
// The date and time that the cluster network interface was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// If `true`:
// - The VPC infrastructure performs any needed NAT operations.
// - `floating_ips` must not have more than one floating IP.
//
// If `false`:
// - Packets are passed unchanged to/from the virtual network interface,
// allowing the workload to perform any needed NAT operations.
EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"`
// The URL for this cluster network interface.
Href *string `json:"href" validate:"required"`
// The unique identifier for this cluster network interface.
ID *string `json:"id" validate:"required"`
// The reasons for the current `lifecycle_state` (if any).
LifecycleReasons []ClusterNetworkInterfaceLifecycleReason `json:"lifecycle_reasons" validate:"required"`
// The lifecycle state of the cluster network interface.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The MAC address of the cluster network interface. May be absent if
// `lifecycle_state` is `pending`.
MacAddress *string `json:"mac_address,omitempty"`
// The name for this cluster network interface. The name is unique across all interfaces in the cluster network.
Name *string `json:"name" validate:"required"`
// The cluster network subnet reserved IP for this cluster network interface.
PrimaryIP *ClusterNetworkSubnetReservedIPReference `json:"primary_ip" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
Subnet *ClusterNetworkSubnetReference `json:"subnet,omitempty"`
// The target of this cluster network interface.
//
// If absent, this cluster network interface is not attached to a target.
//
// The resources supported by this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Target ClusterNetworkInterfaceTargetIntf `json:"target,omitempty"`
// The VPC this cluster network interface resides in.
VPC *VPCReference `json:"vpc" validate:"required"`
// The zone this cluster network interface resides in.
Zone *ZoneReference `json:"zone" validate:"required"`
}
// Constants associated with the ClusterNetworkInterface.LifecycleState property.
// The lifecycle state of the cluster network interface.
const (
ClusterNetworkInterfaceLifecycleStateDeletingConst = "deleting"
ClusterNetworkInterfaceLifecycleStateFailedConst = "failed"
ClusterNetworkInterfaceLifecycleStatePendingConst = "pending"
ClusterNetworkInterfaceLifecycleStateStableConst = "stable"
ClusterNetworkInterfaceLifecycleStateSuspendedConst = "suspended"
ClusterNetworkInterfaceLifecycleStateUpdatingConst = "updating"
ClusterNetworkInterfaceLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the ClusterNetworkInterface.ResourceType property.
// The resource type.
const (
ClusterNetworkInterfaceResourceTypeClusterNetworkInterfaceConst = "cluster_network_interface"
)
// UnmarshalClusterNetworkInterface unmarshals an instance of ClusterNetworkInterface from the specified map of raw messages.
func UnmarshalClusterNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkInterface)
err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing)
if err != nil {
err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat)
if err != nil {
err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalClusterNetworkInterfaceLifecycleReason)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress)
if err != nil {
err = core.SDKErrorf(err, "", "mac_address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalClusterNetworkSubnetReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalClusterNetworkSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalClusterNetworkInterfaceTarget)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkInterfaceCollection : ClusterNetworkInterfaceCollection struct
type ClusterNetworkInterfaceCollection struct {
// A link to the first page of resources.
First *PageLink `json:"first" validate:"required"`
// A page of cluster network interfaces.
Interfaces []ClusterNetworkInterface `json:"interfaces" 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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalClusterNetworkInterfaceCollection unmarshals an instance of ClusterNetworkInterfaceCollection from the specified map of raw messages.
func UnmarshalClusterNetworkInterfaceCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkInterfaceCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "interfaces", &obj.Interfaces, UnmarshalClusterNetworkInterface)
if err != nil {
err = core.SDKErrorf(err, "", "interfaces-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ClusterNetworkInterfaceCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ClusterNetworkInterfaceLifecycleReason : ClusterNetworkInterfaceLifecycleReason struct
type ClusterNetworkInterfaceLifecycleReason struct {
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this lifecycle state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this lifecycle state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the ClusterNetworkInterfaceLifecycleReason.Code property.
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ClusterNetworkInterfaceLifecycleReasonCodeInternalErrorConst = "internal_error"
ClusterNetworkInterfaceLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider"
)
// UnmarshalClusterNetworkInterfaceLifecycleReason unmarshals an instance of ClusterNetworkInterfaceLifecycleReason from the specified map of raw messages.
func UnmarshalClusterNetworkInterfaceLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkInterfaceLifecycleReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkInterfacePatch : ClusterNetworkInterfacePatch struct
type ClusterNetworkInterfacePatch struct {
// Indicates whether this cluster network interface will be automatically deleted when `target` is deleted. Must be
// `false` if the cluster network interface is unbound.
AutoDelete *bool `json:"auto_delete,omitempty"`
// The name for this cluster network interface. The name must not be used by another interface in the cluster network.
// Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed.
Name *string `json:"name,omitempty"`
}
// UnmarshalClusterNetworkInterfacePatch unmarshals an instance of ClusterNetworkInterfacePatch from the specified map of raw messages.
func UnmarshalClusterNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkInterfacePatch)
err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the ClusterNetworkInterfacePatch
func (clusterNetworkInterfacePatch *ClusterNetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(clusterNetworkInterfacePatch.AutoDelete) {
_patch["auto_delete"] = clusterNetworkInterfacePatch.AutoDelete
}
if !core.IsNil(clusterNetworkInterfacePatch.Name) {
_patch["name"] = clusterNetworkInterfacePatch.Name
}
return
}
// ClusterNetworkInterfacePrimaryIPPrototype : ClusterNetworkInterfacePrimaryIPPrototype struct
// Models which "extend" this model:
// - ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPIdentityClusterNetworkInterfacePrimaryIPContext
// - ClusterNetworkInterfacePrimaryIPPrototypeClusterNetworkSubnetReservedIPPrototypeClusterNetworkInterfacePrimaryIPContext
type ClusterNetworkInterfacePrimaryIPPrototype struct {
// The unique identifier for this cluster network subnet reserved IP.
ID *string `json:"id,omitempty"`
// The URL for this cluster network subnet reserved IP.
Href *string `json:"href,omitempty"`
// The IP address to reserve, which must not already be reserved on the subnet.
//
// If unspecified, an available address on the subnet will automatically be selected.
Address *string `json:"address,omitempty"`
// Indicates whether this cluster network subnet reserved IP member will be automatically deleted when either `target`
// is deleted, or the cluster network subnet reserved IP is unbound.
AutoDelete *bool `json:"auto_delete,omitempty"`
// The name for this cluster network subnet reserved IP. The name must not be used by another reserved IP in the
// cluster network subnet. Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed.
// If unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
}
func (*ClusterNetworkInterfacePrimaryIPPrototype) isaClusterNetworkInterfacePrimaryIPPrototype() bool {
return true
}
type ClusterNetworkInterfacePrimaryIPPrototypeIntf interface {
isaClusterNetworkInterfacePrimaryIPPrototype() bool
}
// UnmarshalClusterNetworkInterfacePrimaryIPPrototype unmarshals an instance of ClusterNetworkInterfacePrimaryIPPrototype from the specified map of raw messages.
func UnmarshalClusterNetworkInterfacePrimaryIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkInterfacePrimaryIPPrototype)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkInterfaceReference : The associated cluster network subnet.
type ClusterNetworkInterfaceReference struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this cluster network interface.
Href *string `json:"href" validate:"required"`
// The unique identifier for this cluster network interface.
ID *string `json:"id" validate:"required"`
// The name for this cluster network interface. The name is unique across all interfaces in the cluster network.
Name *string `json:"name" validate:"required"`
// The primary IP for this cluster network interface.
PrimaryIP *ClusterNetworkSubnetReservedIPReference `json:"primary_ip" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
Subnet *ClusterNetworkSubnetReference `json:"subnet" validate:"required"`
}
// Constants associated with the ClusterNetworkInterfaceReference.ResourceType property.
// The resource type.
const (
ClusterNetworkInterfaceReferenceResourceTypeClusterNetworkInterfaceConst = "cluster_network_interface"
)
// UnmarshalClusterNetworkInterfaceReference unmarshals an instance of ClusterNetworkInterfaceReference from the specified map of raw messages.
func UnmarshalClusterNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkInterfaceReference)
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalClusterNetworkSubnetReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalClusterNetworkSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkInterfaceTarget : The target of this cluster network interface.
//
// If absent, this cluster network interface is not attached to a target.
//
// The resources supported by this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
// Models which "extend" this model:
// - ClusterNetworkInterfaceTargetInstanceClusterNetworkAttachmentReferenceClusterNetworkInterfaceContext
type ClusterNetworkInterfaceTarget struct {
// The URL for this instance cluster network attachment.
Href *string `json:"href,omitempty"`
// The unique identifier for this instance cluster network attachment.
ID *string `json:"id,omitempty"`
// The name for this instance cluster network attachment. The name is unique across all network attachments for the
// instance.
Name *string `json:"name,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type,omitempty"`
}
// Constants associated with the ClusterNetworkInterfaceTarget.ResourceType property.
// The resource type.
const (
ClusterNetworkInterfaceTargetResourceTypeInstanceClusterNetworkAttachmentConst = "instance_cluster_network_attachment"
)
func (*ClusterNetworkInterfaceTarget) isaClusterNetworkInterfaceTarget() bool {
return true
}
type ClusterNetworkInterfaceTargetIntf interface {
isaClusterNetworkInterfaceTarget() bool
}
// UnmarshalClusterNetworkInterfaceTarget unmarshals an instance of ClusterNetworkInterfaceTarget from the specified map of raw messages.
func UnmarshalClusterNetworkInterfaceTarget(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkInterfaceTarget)
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkLifecycleReason : ClusterNetworkLifecycleReason struct
type ClusterNetworkLifecycleReason struct {
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this lifecycle state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this lifecycle state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the ClusterNetworkLifecycleReason.Code property.
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ClusterNetworkLifecycleReasonCodeInternalErrorConst = "internal_error"
ClusterNetworkLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider"
)
// UnmarshalClusterNetworkLifecycleReason unmarshals an instance of ClusterNetworkLifecycleReason from the specified map of raw messages.
func UnmarshalClusterNetworkLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkLifecycleReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkPatch : ClusterNetworkPatch struct
type ClusterNetworkPatch struct {
// The name for this cluster network. The name must not be used by another cluster network in the region. Names
// starting with `ibm-` are reserved for provider-owned resources, and are not allowed.
Name *string `json:"name,omitempty"`
}
// UnmarshalClusterNetworkPatch unmarshals an instance of ClusterNetworkPatch from the specified map of raw messages.
func UnmarshalClusterNetworkPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkPatch)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the ClusterNetworkPatch
func (clusterNetworkPatch *ClusterNetworkPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(clusterNetworkPatch.Name) {
_patch["name"] = clusterNetworkPatch.Name
}
return
}
// ClusterNetworkProfile : ClusterNetworkProfile struct
type ClusterNetworkProfile struct {
// The product family this cluster network profile belongs to.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Family *string `json:"family" validate:"required"`
// The URL for this cluster network profile.
Href *string `json:"href" validate:"required"`
// The globally unique name for this cluster network profile.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The instance profiles that support this cluster network profile.
SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"`
// Zones in this region that support this cluster network profile.
Zones []ZoneReference `json:"zones" validate:"required"`
}
// Constants associated with the ClusterNetworkProfile.Family property.
// The product family this cluster network profile belongs to.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ClusterNetworkProfileFamilyVelaConst = "vela"
)
// Constants associated with the ClusterNetworkProfile.ResourceType property.
// The resource type.
const (
ClusterNetworkProfileResourceTypeClusterNetworkProfileConst = "cluster_network_profile"
)
// UnmarshalClusterNetworkProfile unmarshals an instance of ClusterNetworkProfile from the specified map of raw messages.
func UnmarshalClusterNetworkProfile(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkProfile)
err = core.UnmarshalPrimitive(m, "family", &obj.Family)
if err != nil {
err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference)
if err != nil {
err = core.SDKErrorf(err, "", "supported_instance_profiles-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zones-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkProfileCollection : ClusterNetworkProfileCollection struct
type ClusterNetworkProfileCollection struct {
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of cluster network profiles.
Profiles []ClusterNetworkProfile `json:"profiles" validate:"required"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalClusterNetworkProfileCollection unmarshals an instance of ClusterNetworkProfileCollection from the specified map of raw messages.
func UnmarshalClusterNetworkProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkProfileCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalClusterNetworkProfile)
if err != nil {
err = core.SDKErrorf(err, "", "profiles-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ClusterNetworkProfileCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ClusterNetworkProfileIdentity : Identifies an cluster network profile by a unique property.
// Models which "extend" this model:
// - ClusterNetworkProfileIdentityByName
// - ClusterNetworkProfileIdentityByHref
type ClusterNetworkProfileIdentity struct {
// The globally unique name for this cluster network profile.
Name *string `json:"name,omitempty"`
// The URL for this cluster network profile.
Href *string `json:"href,omitempty"`
}
func (*ClusterNetworkProfileIdentity) isaClusterNetworkProfileIdentity() bool {
return true
}
type ClusterNetworkProfileIdentityIntf interface {
isaClusterNetworkProfileIdentity() bool
}
// UnmarshalClusterNetworkProfileIdentity unmarshals an instance of ClusterNetworkProfileIdentity from the specified map of raw messages.
func UnmarshalClusterNetworkProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkProfileIdentity)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkProfileReference : ClusterNetworkProfileReference struct
type ClusterNetworkProfileReference struct {
// The URL for this cluster network profile.
Href *string `json:"href" validate:"required"`
// The globally unique name for this cluster network profile.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the ClusterNetworkProfileReference.ResourceType property.
// The resource type.
const (
ClusterNetworkProfileReferenceResourceTypeClusterNetworkProfileConst = "cluster_network_profile"
)
// UnmarshalClusterNetworkProfileReference unmarshals an instance of ClusterNetworkProfileReference from the specified map of raw messages.
func UnmarshalClusterNetworkProfileReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkProfileReference)
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkReference : ClusterNetworkReference struct
type ClusterNetworkReference struct {
// The CRN for this cluster network.
CRN *string `json:"crn" validate:"required"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this cluster network.
Href *string `json:"href" validate:"required"`
// The unique identifier for this cluster network.
ID *string `json:"id" validate:"required"`
// The name for this cluster network. The name must not be used by another cluster network in the region.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the ClusterNetworkReference.ResourceType property.
// The resource type.
const (
ClusterNetworkReferenceResourceTypeClusterNetworkConst = "cluster_network"
)
// UnmarshalClusterNetworkReference unmarshals an instance of ClusterNetworkReference from the specified map of raw messages.
func UnmarshalClusterNetworkReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkReference)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkSubnet : ClusterNetworkSubnet struct
type ClusterNetworkSubnet struct {
// The number of IPv4 addresses in this cluster network 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 cluster network subnet was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The URL for this cluster network subnet.
Href *string `json:"href" validate:"required"`
// The unique identifier for this cluster network subnet.
ID *string `json:"id" validate:"required"`
// The IP version for this cluster network subnet.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
IPVersion *string `json:"ip_version" validate:"required"`
// The IPv4 range of this cluster network subnet, expressed in CIDR format.
Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"`
// The reasons for the current `lifecycle_state` (if any).
LifecycleReasons []ClusterNetworkSubnetLifecycleReason `json:"lifecycle_reasons" validate:"required"`
// The lifecycle state of the cluster network subnet.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The name for this cluster network subnet. The name is unique across all cluster network subnets in the cluster
// network.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The total number of IPv4 addresses in this cluster network 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"`
}
// Constants associated with the ClusterNetworkSubnet.IPVersion property.
// The IP version for this cluster network subnet.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ClusterNetworkSubnetIPVersionIpv4Const = "ipv4"
)
// Constants associated with the ClusterNetworkSubnet.LifecycleState property.
// The lifecycle state of the cluster network subnet.
const (
ClusterNetworkSubnetLifecycleStateDeletingConst = "deleting"
ClusterNetworkSubnetLifecycleStateFailedConst = "failed"
ClusterNetworkSubnetLifecycleStatePendingConst = "pending"
ClusterNetworkSubnetLifecycleStateStableConst = "stable"
ClusterNetworkSubnetLifecycleStateSuspendedConst = "suspended"
ClusterNetworkSubnetLifecycleStateUpdatingConst = "updating"
ClusterNetworkSubnetLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the ClusterNetworkSubnet.ResourceType property.
// The resource type.
const (
ClusterNetworkSubnetResourceTypeClusterNetworkSubnetConst = "cluster_network_subnet"
)
// UnmarshalClusterNetworkSubnet unmarshals an instance of ClusterNetworkSubnet from the specified map of raw messages.
func UnmarshalClusterNetworkSubnet(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkSubnet)
err = core.UnmarshalPrimitive(m, "available_ipv4_address_count", &obj.AvailableIpv4AddressCount)
if err != nil {
err = core.SDKErrorf(err, "", "available_ipv4_address_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion)
if err != nil {
err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock)
if err != nil {
err = core.SDKErrorf(err, "", "ipv4_cidr_block-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalClusterNetworkSubnetLifecycleReason)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_ipv4_address_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkSubnetCollection : ClusterNetworkSubnetCollection struct
type ClusterNetworkSubnetCollection struct {
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of subnets for the cluster network.
Subnets []ClusterNetworkSubnet `json:"subnets" validate:"required"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalClusterNetworkSubnetCollection unmarshals an instance of ClusterNetworkSubnetCollection from the specified map of raw messages.
func UnmarshalClusterNetworkSubnetCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkSubnetCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalClusterNetworkSubnet)
if err != nil {
err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ClusterNetworkSubnetCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ClusterNetworkSubnetIdentity : Identifies a cluster network subnet by a unique property.
// Models which "extend" this model:
// - ClusterNetworkSubnetIdentityByID
// - ClusterNetworkSubnetIdentityByHref
type ClusterNetworkSubnetIdentity struct {
// The unique identifier for this cluster network subnet.
ID *string `json:"id,omitempty"`
// The URL for this cluster network subnet.
Href *string `json:"href,omitempty"`
}
func (*ClusterNetworkSubnetIdentity) isaClusterNetworkSubnetIdentity() bool {
return true
}
type ClusterNetworkSubnetIdentityIntf interface {
isaClusterNetworkSubnetIdentity() bool
}
// UnmarshalClusterNetworkSubnetIdentity unmarshals an instance of ClusterNetworkSubnetIdentity from the specified map of raw messages.
func UnmarshalClusterNetworkSubnetIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkSubnetIdentity)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkSubnetLifecycleReason : ClusterNetworkSubnetLifecycleReason struct
type ClusterNetworkSubnetLifecycleReason struct {
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this lifecycle state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this lifecycle state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the ClusterNetworkSubnetLifecycleReason.Code property.
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ClusterNetworkSubnetLifecycleReasonCodeInternalErrorConst = "internal_error"
ClusterNetworkSubnetLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider"
)
// UnmarshalClusterNetworkSubnetLifecycleReason unmarshals an instance of ClusterNetworkSubnetLifecycleReason from the specified map of raw messages.
func UnmarshalClusterNetworkSubnetLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkSubnetLifecycleReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkSubnetPatch : ClusterNetworkSubnetPatch struct
type ClusterNetworkSubnetPatch struct {
// The name for this cluster network subnet. The name must not be used by another cluster network subnet in the cluster
// network. Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed.
Name *string `json:"name,omitempty"`
}
// UnmarshalClusterNetworkSubnetPatch unmarshals an instance of ClusterNetworkSubnetPatch from the specified map of raw messages.
func UnmarshalClusterNetworkSubnetPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkSubnetPatch)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the ClusterNetworkSubnetPatch
func (clusterNetworkSubnetPatch *ClusterNetworkSubnetPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(clusterNetworkSubnetPatch.Name) {
_patch["name"] = clusterNetworkSubnetPatch.Name
}
return
}
// ClusterNetworkSubnetPrefix : A range of addresses available for subnets for this cluster network.
type ClusterNetworkSubnetPrefix struct {
// The allocation policy for this subnet prefix:
// - `auto`: Subnets created by total count in this cluster network can use this prefix.
AllocationPolicy *string `json:"allocation_policy" validate:"required"`
// The CIDR block for this prefix.
CIDR *string `json:"cidr" validate:"required"`
}
// Constants associated with the ClusterNetworkSubnetPrefix.AllocationPolicy property.
// The allocation policy for this subnet prefix:
// - `auto`: Subnets created by total count in this cluster network can use this prefix.
const (
ClusterNetworkSubnetPrefixAllocationPolicyAutoConst = "auto"
)
// UnmarshalClusterNetworkSubnetPrefix unmarshals an instance of ClusterNetworkSubnetPrefix from the specified map of raw messages.
func UnmarshalClusterNetworkSubnetPrefix(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkSubnetPrefix)
err = core.UnmarshalPrimitive(m, "allocation_policy", &obj.AllocationPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "allocation_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "cidr", &obj.CIDR)
if err != nil {
err = core.SDKErrorf(err, "", "cidr-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkSubnetPrefixPrototype : ClusterNetworkSubnetPrefixPrototype struct
type ClusterNetworkSubnetPrefixPrototype struct {
// The IPv4 range of the cluster network's subnet prefix, expressed in CIDR format.
//
// The CIDR prefix length must be less than `/29` (at least 8 addresses).
//
// If a range is specified that overlaps with address prefixes in the cluster network's VPC, the operating systems of
// any virtual server instances attaching to this cluster network must be [configured to avoid
// conflicts](https://cloud.ibm.com/docs/vpc?topic=vpc-planning-cluster-network#advanced-consideration).
CIDR *string `json:"cidr,omitempty"`
}
// UnmarshalClusterNetworkSubnetPrefixPrototype unmarshals an instance of ClusterNetworkSubnetPrefixPrototype from the specified map of raw messages.
func UnmarshalClusterNetworkSubnetPrefixPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkSubnetPrefixPrototype)
err = core.UnmarshalPrimitive(m, "cidr", &obj.CIDR)
if err != nil {
err = core.SDKErrorf(err, "", "cidr-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkSubnetPrototype : ClusterNetworkSubnetPrototype struct
// Models which "extend" this model:
// - ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype
// - ClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype
type ClusterNetworkSubnetPrototype struct {
// The IP version(s) to support for this cluster network subnet.
IPVersion *string `json:"ip_version,omitempty"`
// The name for this cluster network subnet. The name must not be used by another cluster network subnet in the cluster
// network. Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified,
// the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The total number of IPv4 addresses required. Must be a power of 2.
//
// A CIDR will be allocated from a subnet prefix in the cluster network that has an
// `allocation_policy` of `auto`. There must be a subnet prefix that has a free CIDR range with at least this number of
// addresses.
TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count,omitempty"`
// The IPv4 range of the cluster network subnet, expressed in CIDR format. The prefix length of the cluster network
// subnet's CIDR must be between `/8` (16,777,216 addresses) and `/29`
// (8 addresses). The IPv4 range of the cluster network subnet's CIDR must be within the cluster network's
// `subnet_prefixes`.
//
// The range must not overlap with any of the following reserved address ranges:
//
// - `127.0.0.0/8` (IPv4 loopback addresses)
// - `169.254.0.0/16` (IPv4 link-local addresses)
// - `224.0.0.0/4` (IPv4 multicast addresses).
Ipv4CIDRBlock *string `json:"ipv4_cidr_block,omitempty"`
}
// Constants associated with the ClusterNetworkSubnetPrototype.IPVersion property.
// The IP version(s) to support for this cluster network subnet.
const (
ClusterNetworkSubnetPrototypeIPVersionIpv4Const = "ipv4"
)
func (*ClusterNetworkSubnetPrototype) isaClusterNetworkSubnetPrototype() bool {
return true
}
type ClusterNetworkSubnetPrototypeIntf interface {
isaClusterNetworkSubnetPrototype() bool
}
// UnmarshalClusterNetworkSubnetPrototype unmarshals an instance of ClusterNetworkSubnetPrototype from the specified map of raw messages.
func UnmarshalClusterNetworkSubnetPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkSubnetPrototype)
err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion)
if err != nil {
err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_ipv4_address_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock)
if err != nil {
err = core.SDKErrorf(err, "", "ipv4_cidr_block-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkSubnetReference : ClusterNetworkSubnetReference struct
type ClusterNetworkSubnetReference struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this cluster network subnet.
Href *string `json:"href" validate:"required"`
// The unique identifier for this cluster network subnet.
ID *string `json:"id" validate:"required"`
// The name for this cluster network subnet. The name is unique across all cluster network subnets in the cluster
// network.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the ClusterNetworkSubnetReference.ResourceType property.
// The resource type.
const (
ClusterNetworkSubnetReferenceResourceTypeClusterNetworkSubnetConst = "cluster_network_subnet"
)
// UnmarshalClusterNetworkSubnetReference unmarshals an instance of ClusterNetworkSubnetReference from the specified map of raw messages.
func UnmarshalClusterNetworkSubnetReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkSubnetReference)
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkSubnetReservedIP : ClusterNetworkSubnetReservedIP struct
type ClusterNetworkSubnetReservedIP struct {
// The IP address.
//
// If the address is pending allocation, the value will be `0.0.0.0`.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in
// the future.
Address *string `json:"address" validate:"required"`
// Indicates whether this cluster network subnet reserved IP member will be automatically deleted when either `target`
// is deleted, or the cluster network subnet reserved IP is unbound.
AutoDelete *bool `json:"auto_delete" validate:"required"`
// The date and time that the cluster network subnet reserved IP was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The URL for this cluster network subnet reserved IP.
Href *string `json:"href" validate:"required"`
// The unique identifier for this cluster network subnet reserved IP.
ID *string `json:"id" validate:"required"`
// The reasons for the current `lifecycle_state` (if any).
LifecycleReasons []ClusterNetworkSubnetReservedIPLifecycleReason `json:"lifecycle_reasons" validate:"required"`
// The lifecycle state of the cluster network subnet reserved IP.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The name for this cluster network subnet reserved IP. The name is unique across all reserved IPs in a cluster
// network subnet.
Name *string `json:"name" validate:"required"`
// The owner of the cluster network subnet reserved IP
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Owner *string `json:"owner" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The target this cluster network subnet reserved IP is bound to.
//
// If absent, this cluster network subnet reserved IP is provider-owned or unbound.
Target ClusterNetworkSubnetReservedIPTargetIntf `json:"target,omitempty"`
}
// Constants associated with the ClusterNetworkSubnetReservedIP.LifecycleState property.
// The lifecycle state of the cluster network subnet reserved IP.
const (
ClusterNetworkSubnetReservedIPLifecycleStateDeletingConst = "deleting"
ClusterNetworkSubnetReservedIPLifecycleStateFailedConst = "failed"
ClusterNetworkSubnetReservedIPLifecycleStatePendingConst = "pending"
ClusterNetworkSubnetReservedIPLifecycleStateStableConst = "stable"
ClusterNetworkSubnetReservedIPLifecycleStateSuspendedConst = "suspended"
ClusterNetworkSubnetReservedIPLifecycleStateUpdatingConst = "updating"
ClusterNetworkSubnetReservedIPLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the ClusterNetworkSubnetReservedIP.Owner property.
// The owner of the cluster network subnet reserved IP
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ClusterNetworkSubnetReservedIPOwnerProviderConst = "provider"
ClusterNetworkSubnetReservedIPOwnerUserConst = "user"
)
// Constants associated with the ClusterNetworkSubnetReservedIP.ResourceType property.
// The resource type.
const (
ClusterNetworkSubnetReservedIPResourceTypeClusterNetworkSubnetReservedIPConst = "cluster_network_subnet_reserved_ip"
)
// UnmarshalClusterNetworkSubnetReservedIP unmarshals an instance of ClusterNetworkSubnetReservedIP from the specified map of raw messages.
func UnmarshalClusterNetworkSubnetReservedIP(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkSubnetReservedIP)
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalClusterNetworkSubnetReservedIPLifecycleReason)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "owner", &obj.Owner)
if err != nil {
err = core.SDKErrorf(err, "", "owner-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalClusterNetworkSubnetReservedIPTarget)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkSubnetReservedIPCollection : ClusterNetworkSubnetReservedIPCollection struct
type ClusterNetworkSubnetReservedIPCollection struct {
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of reserved IPs for the cluster network subnet.
ReservedIps []ClusterNetworkSubnetReservedIP `json:"reserved_ips" validate:"required"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalClusterNetworkSubnetReservedIPCollection unmarshals an instance of ClusterNetworkSubnetReservedIPCollection from the specified map of raw messages.
func UnmarshalClusterNetworkSubnetReservedIPCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkSubnetReservedIPCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "reserved_ips", &obj.ReservedIps, UnmarshalClusterNetworkSubnetReservedIP)
if err != nil {
err = core.SDKErrorf(err, "", "reserved_ips-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ClusterNetworkSubnetReservedIPCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ClusterNetworkSubnetReservedIPLifecycleReason : ClusterNetworkSubnetReservedIPLifecycleReason struct
type ClusterNetworkSubnetReservedIPLifecycleReason struct {
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this lifecycle state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this lifecycle state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the ClusterNetworkSubnetReservedIPLifecycleReason.Code property.
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ClusterNetworkSubnetReservedIPLifecycleReasonCodeInternalErrorConst = "internal_error"
ClusterNetworkSubnetReservedIPLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider"
)
// UnmarshalClusterNetworkSubnetReservedIPLifecycleReason unmarshals an instance of ClusterNetworkSubnetReservedIPLifecycleReason from the specified map of raw messages.
func UnmarshalClusterNetworkSubnetReservedIPLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkSubnetReservedIPLifecycleReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkSubnetReservedIPPatch : ClusterNetworkSubnetReservedIPPatch struct
type ClusterNetworkSubnetReservedIPPatch struct {
// Indicates whether this cluster network subnet reserved IP member will be automatically deleted when either `target`
// is deleted, or the cluster network subnet reserved IP is unbound. Must be `false` if the cluster network subnet
// reserved IP is unbound.
AutoDelete *bool `json:"auto_delete,omitempty"`
// The name for this cluster network subnet reserved IP. The name must not be used by another reserved IP in the
// cluster network subnet. Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed.
Name *string `json:"name,omitempty"`
}
// UnmarshalClusterNetworkSubnetReservedIPPatch unmarshals an instance of ClusterNetworkSubnetReservedIPPatch from the specified map of raw messages.
func UnmarshalClusterNetworkSubnetReservedIPPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkSubnetReservedIPPatch)
err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the ClusterNetworkSubnetReservedIPPatch
func (clusterNetworkSubnetReservedIPPatch *ClusterNetworkSubnetReservedIPPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(clusterNetworkSubnetReservedIPPatch.AutoDelete) {
_patch["auto_delete"] = clusterNetworkSubnetReservedIPPatch.AutoDelete
}
if !core.IsNil(clusterNetworkSubnetReservedIPPatch.Name) {
_patch["name"] = clusterNetworkSubnetReservedIPPatch.Name
}
return
}
// ClusterNetworkSubnetReservedIPReference : ClusterNetworkSubnetReservedIPReference struct
type ClusterNetworkSubnetReservedIPReference struct {
// The IP address.
//
// If the address is pending allocation, the value will be `0.0.0.0`.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in
// the future.
Address *string `json:"address" validate:"required"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this cluster network subnet reserved IP.
Href *string `json:"href" validate:"required"`
// The unique identifier for this cluster network subnet reserved IP.
ID *string `json:"id" validate:"required"`
// The name for this cluster network subnet reserved IP. The name is unique across all reserved IPs in a cluster
// network subnet.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the ClusterNetworkSubnetReservedIPReference.ResourceType property.
// The resource type.
const (
ClusterNetworkSubnetReservedIPReferenceResourceTypeClusterNetworkSubnetReservedIPConst = "cluster_network_subnet_reserved_ip"
)
// UnmarshalClusterNetworkSubnetReservedIPReference unmarshals an instance of ClusterNetworkSubnetReservedIPReference from the specified map of raw messages.
func UnmarshalClusterNetworkSubnetReservedIPReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkSubnetReservedIPReference)
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ClusterNetworkSubnetReservedIPTarget : The target this cluster network subnet reserved IP is bound to.
//
// If absent, this cluster network subnet reserved IP is provider-owned or unbound.
// Models which "extend" this model:
// - ClusterNetworkSubnetReservedIPTargetClusterNetworkInterfaceReferenceClusterNetworkSubnetReservedIPTargetContext
type ClusterNetworkSubnetReservedIPTarget struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this cluster network interface.
Href *string `json:"href,omitempty"`
// The unique identifier for this cluster network interface.
ID *string `json:"id,omitempty"`
// The name for this cluster network interface. The name is unique across all interfaces in the cluster network.
Name *string `json:"name,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type,omitempty"`
}
// Constants associated with the ClusterNetworkSubnetReservedIPTarget.ResourceType property.
// The resource type.
const (
ClusterNetworkSubnetReservedIPTargetResourceTypeClusterNetworkInterfaceConst = "cluster_network_interface"
)
func (*ClusterNetworkSubnetReservedIPTarget) isaClusterNetworkSubnetReservedIPTarget() bool {
return true
}
type ClusterNetworkSubnetReservedIPTargetIntf interface {
isaClusterNetworkSubnetReservedIPTarget() bool
}
// UnmarshalClusterNetworkSubnetReservedIPTarget unmarshals an instance of ClusterNetworkSubnetReservedIPTarget from the specified map of raw messages.
func UnmarshalClusterNetworkSubnetReservedIPTarget(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ClusterNetworkSubnetReservedIPTarget)
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// CreateBackupPolicyOptions : The CreateBackupPolicy options.
type CreateBackupPolicyOptions struct {
// The backup policy prototype object.
BackupPolicyPrototype BackupPolicyPrototypeIntf `json:"BackupPolicyPrototype" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateBackupPolicyOptions : Instantiate CreateBackupPolicyOptions
func (*VpcV1) NewCreateBackupPolicyOptions(backupPolicyPrototype BackupPolicyPrototypeIntf) *CreateBackupPolicyOptions {
return &CreateBackupPolicyOptions{
BackupPolicyPrototype: backupPolicyPrototype,
}
}
// SetBackupPolicyPrototype : Allow user to set BackupPolicyPrototype
func (_options *CreateBackupPolicyOptions) SetBackupPolicyPrototype(backupPolicyPrototype BackupPolicyPrototypeIntf) *CreateBackupPolicyOptions {
_options.BackupPolicyPrototype = backupPolicyPrototype
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateBackupPolicyOptions) SetHeaders(param map[string]string) *CreateBackupPolicyOptions {
options.Headers = param
return options
}
// CreateBackupPolicyPlanOptions : The CreateBackupPolicyPlan options.
type CreateBackupPolicyPlanOptions struct {
// The backup policy identifier.
BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="`
// The cron specification for the backup schedule. The backup policy jobs
// (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes
// after this time.
//
// All backup schedules for plans in the same policy must be at least an hour apart.
CronSpec *string `json:"cron_spec" validate:"required"`
// Indicates whether the plan is active.
Active *bool `json:"active,omitempty"`
// The user tags to attach to each backup (snapshot) created by this plan.
AttachUserTags []string `json:"attach_user_tags,omitempty"`
ClonePolicy *BackupPolicyPlanClonePolicyPrototype `json:"clone_policy,omitempty"`
// Indicates whether to copy the source's user tags to the created backups (snapshots).
CopyUserTags *bool `json:"copy_user_tags,omitempty"`
DeletionTrigger *BackupPolicyPlanDeletionTriggerPrototype `json:"deletion_trigger,omitempty"`
// The name for this backup policy plan. The name must not be used by another plan for the backup policy. If
// unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The policies for additional backups in remote regions.
RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateBackupPolicyPlanOptions : Instantiate CreateBackupPolicyPlanOptions
func (*VpcV1) NewCreateBackupPolicyPlanOptions(backupPolicyID string, cronSpec string) *CreateBackupPolicyPlanOptions {
return &CreateBackupPolicyPlanOptions{
BackupPolicyID: core.StringPtr(backupPolicyID),
CronSpec: core.StringPtr(cronSpec),
}
}
// SetBackupPolicyID : Allow user to set BackupPolicyID
func (_options *CreateBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *CreateBackupPolicyPlanOptions {
_options.BackupPolicyID = core.StringPtr(backupPolicyID)
return _options
}
// SetCronSpec : Allow user to set CronSpec
func (_options *CreateBackupPolicyPlanOptions) SetCronSpec(cronSpec string) *CreateBackupPolicyPlanOptions {
_options.CronSpec = core.StringPtr(cronSpec)
return _options
}
// SetActive : Allow user to set Active
func (_options *CreateBackupPolicyPlanOptions) SetActive(active bool) *CreateBackupPolicyPlanOptions {
_options.Active = core.BoolPtr(active)
return _options
}
// SetAttachUserTags : Allow user to set AttachUserTags
func (_options *CreateBackupPolicyPlanOptions) SetAttachUserTags(attachUserTags []string) *CreateBackupPolicyPlanOptions {
_options.AttachUserTags = attachUserTags
return _options
}
// SetClonePolicy : Allow user to set ClonePolicy
func (_options *CreateBackupPolicyPlanOptions) SetClonePolicy(clonePolicy *BackupPolicyPlanClonePolicyPrototype) *CreateBackupPolicyPlanOptions {
_options.ClonePolicy = clonePolicy
return _options
}
// SetCopyUserTags : Allow user to set CopyUserTags
func (_options *CreateBackupPolicyPlanOptions) SetCopyUserTags(copyUserTags bool) *CreateBackupPolicyPlanOptions {
_options.CopyUserTags = core.BoolPtr(copyUserTags)
return _options
}
// SetDeletionTrigger : Allow user to set DeletionTrigger
func (_options *CreateBackupPolicyPlanOptions) SetDeletionTrigger(deletionTrigger *BackupPolicyPlanDeletionTriggerPrototype) *CreateBackupPolicyPlanOptions {
_options.DeletionTrigger = deletionTrigger
return _options
}
// SetName : Allow user to set Name
func (_options *CreateBackupPolicyPlanOptions) SetName(name string) *CreateBackupPolicyPlanOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetRemoteRegionPolicies : Allow user to set RemoteRegionPolicies
func (_options *CreateBackupPolicyPlanOptions) SetRemoteRegionPolicies(remoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype) *CreateBackupPolicyPlanOptions {
_options.RemoteRegionPolicies = remoteRegionPolicies
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateBackupPolicyPlanOptions) SetHeaders(param map[string]string) *CreateBackupPolicyPlanOptions {
options.Headers = param
return options
}
// CreateBareMetalServerConsoleAccessTokenOptions : The CreateBareMetalServerConsoleAccessToken options.
type CreateBareMetalServerConsoleAccessTokenOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// The bare metal server console type for which this token may be used
//
// Must be `serial` for bare metal servers with a `cpu.architecture` of `s390x`.
ConsoleType *string `json:"console_type" 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,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the CreateBareMetalServerConsoleAccessTokenOptions.ConsoleType property.
// The bare metal server console type for which this token may be used
//
// Must be `serial` for bare metal servers with a `cpu.architecture` of `s390x`.
const (
CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeSerialConst = "serial"
CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeVncConst = "vnc"
)
// NewCreateBareMetalServerConsoleAccessTokenOptions : Instantiate CreateBareMetalServerConsoleAccessTokenOptions
func (*VpcV1) NewCreateBareMetalServerConsoleAccessTokenOptions(bareMetalServerID string, consoleType string) *CreateBareMetalServerConsoleAccessTokenOptions {
return &CreateBareMetalServerConsoleAccessTokenOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
ConsoleType: core.StringPtr(consoleType),
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerConsoleAccessTokenOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetConsoleType : Allow user to set ConsoleType
func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetConsoleType(consoleType string) *CreateBareMetalServerConsoleAccessTokenOptions {
_options.ConsoleType = core.StringPtr(consoleType)
return _options
}
// SetForce : Allow user to set Force
func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetForce(force bool) *CreateBareMetalServerConsoleAccessTokenOptions {
_options.Force = core.BoolPtr(force)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateBareMetalServerConsoleAccessTokenOptions) SetHeaders(param map[string]string) *CreateBareMetalServerConsoleAccessTokenOptions {
options.Headers = param
return options
}
// CreateBareMetalServerNetworkAttachmentOptions : The CreateBareMetalServerNetworkAttachment options.
type CreateBareMetalServerNetworkAttachmentOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// The bare metal server network attachment prototype object.
BareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf `json:"BareMetalServerNetworkAttachmentPrototype" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateBareMetalServerNetworkAttachmentOptions : Instantiate CreateBareMetalServerNetworkAttachmentOptions
func (*VpcV1) NewCreateBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, bareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf) *CreateBareMetalServerNetworkAttachmentOptions {
return &CreateBareMetalServerNetworkAttachmentOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
BareMetalServerNetworkAttachmentPrototype: bareMetalServerNetworkAttachmentPrototype,
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *CreateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkAttachmentOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetBareMetalServerNetworkAttachmentPrototype : Allow user to set BareMetalServerNetworkAttachmentPrototype
func (_options *CreateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerNetworkAttachmentPrototype(bareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf) *CreateBareMetalServerNetworkAttachmentOptions {
_options.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototype
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkAttachmentOptions {
options.Headers = param
return options
}
// CreateBareMetalServerNetworkInterfaceOptions : The CreateBareMetalServerNetworkInterface options.
type CreateBareMetalServerNetworkInterfaceOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// The bare metal server network interface prototype object.
BareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf `json:"BareMetalServerNetworkInterfacePrototype" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateBareMetalServerNetworkInterfaceOptions : Instantiate CreateBareMetalServerNetworkInterfaceOptions
func (*VpcV1) NewCreateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions {
return &CreateBareMetalServerNetworkInterfaceOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
BareMetalServerNetworkInterfacePrototype: bareMetalServerNetworkInterfacePrototype,
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkInterfaceOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetBareMetalServerNetworkInterfacePrototype : Allow user to set BareMetalServerNetworkInterfacePrototype
func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePrototype(bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions {
_options.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototype
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkInterfaceOptions {
options.Headers = param
return options
}
// CreateBareMetalServerOptions : The CreateBareMetalServer options.
type CreateBareMetalServerOptions struct {
// The bare metal server prototype object.
BareMetalServerPrototype BareMetalServerPrototypeIntf `json:"BareMetalServerPrototype" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateBareMetalServerOptions : Instantiate CreateBareMetalServerOptions
func (*VpcV1) NewCreateBareMetalServerOptions(bareMetalServerPrototype BareMetalServerPrototypeIntf) *CreateBareMetalServerOptions {
return &CreateBareMetalServerOptions{
BareMetalServerPrototype: bareMetalServerPrototype,
}
}
// SetBareMetalServerPrototype : Allow user to set BareMetalServerPrototype
func (_options *CreateBareMetalServerOptions) SetBareMetalServerPrototype(bareMetalServerPrototype BareMetalServerPrototypeIntf) *CreateBareMetalServerOptions {
_options.BareMetalServerPrototype = bareMetalServerPrototype
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateBareMetalServerOptions) SetHeaders(param map[string]string) *CreateBareMetalServerOptions {
options.Headers = param
return options
}
// CreateClusterNetworkAttachmentOptions : The CreateClusterNetworkAttachment options.
type CreateClusterNetworkAttachmentOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// A cluster network interface for the instance cluster network attachment. This can be
// specified using an existing cluster network interface that does not already have a
// `target`, or a prototype object for a new cluster network interface.
//
// This instance must reside in the same VPC as the specified cluster network interface. The
// cluster network interface must reside in the same cluster network as the
// `cluster_network_interface` of any other `cluster_network_attachments` for this instance.
ClusterNetworkInterface InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceIntf `json:"cluster_network_interface" validate:"required"`
// The instance cluster network attachment to insert this instance cluster network attachment
// immediately before.
//
// If unspecified, this instance cluster network attachment will be inserted after all
// existing instance cluster network attachments.
Before InstanceClusterNetworkAttachmentBeforePrototypeIntf `json:"before,omitempty"`
// The name for this cluster network attachment. Names must be unique within the instance the cluster network
// attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. Names starting
// with `ibm-` are reserved for provider-owned resources, and are not allowed.
Name *string `json:"name,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateClusterNetworkAttachmentOptions : Instantiate CreateClusterNetworkAttachmentOptions
func (*VpcV1) NewCreateClusterNetworkAttachmentOptions(instanceID string, clusterNetworkInterface InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceIntf) *CreateClusterNetworkAttachmentOptions {
return &CreateClusterNetworkAttachmentOptions{
InstanceID: core.StringPtr(instanceID),
ClusterNetworkInterface: clusterNetworkInterface,
}
}
// SetInstanceID : Allow user to set InstanceID
func (_options *CreateClusterNetworkAttachmentOptions) SetInstanceID(instanceID string) *CreateClusterNetworkAttachmentOptions {
_options.InstanceID = core.StringPtr(instanceID)
return _options
}
// SetClusterNetworkInterface : Allow user to set ClusterNetworkInterface
func (_options *CreateClusterNetworkAttachmentOptions) SetClusterNetworkInterface(clusterNetworkInterface InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceIntf) *CreateClusterNetworkAttachmentOptions {
_options.ClusterNetworkInterface = clusterNetworkInterface
return _options
}
// SetBefore : Allow user to set Before
func (_options *CreateClusterNetworkAttachmentOptions) SetBefore(before InstanceClusterNetworkAttachmentBeforePrototypeIntf) *CreateClusterNetworkAttachmentOptions {
_options.Before = before
return _options
}
// SetName : Allow user to set Name
func (_options *CreateClusterNetworkAttachmentOptions) SetName(name string) *CreateClusterNetworkAttachmentOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateClusterNetworkAttachmentOptions) SetHeaders(param map[string]string) *CreateClusterNetworkAttachmentOptions {
options.Headers = param
return options
}
// CreateClusterNetworkInterfaceOptions : The CreateClusterNetworkInterface options.
type CreateClusterNetworkInterfaceOptions struct {
// The cluster network identifier.
ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="`
// The name for this cluster network interface. The name must not be used by another interface in the cluster network.
// Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name
// will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The primary IP address to bind to the cluster network interface. May be either
// a cluster network subnet reserved IP identity, or a cluster network subnet reserved IP
// prototype object which will be used to create a new cluster network subnet reserved IP.
//
// If a cluster network subnet reserved IP identity is provided, the specified cluster
// network subnet reserved IP must be unbound.
//
// If a cluster network subnet reserved IP prototype object with an address is provided,
// the address must be available on the cluster network interface's cluster network
// subnet. If no address is specified, an available address on the cluster network subnet
// will be automatically selected and reserved.
PrimaryIP ClusterNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"`
// The associated cluster network subnet. Required if `primary_ip` does not specify a cluster
// network subnet reserved IP identity.
Subnet ClusterNetworkSubnetIdentityIntf `json:"subnet,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateClusterNetworkInterfaceOptions : Instantiate CreateClusterNetworkInterfaceOptions
func (*VpcV1) NewCreateClusterNetworkInterfaceOptions(clusterNetworkID string) *CreateClusterNetworkInterfaceOptions {
return &CreateClusterNetworkInterfaceOptions{
ClusterNetworkID: core.StringPtr(clusterNetworkID),
}
}
// SetClusterNetworkID : Allow user to set ClusterNetworkID
func (_options *CreateClusterNetworkInterfaceOptions) SetClusterNetworkID(clusterNetworkID string) *CreateClusterNetworkInterfaceOptions {
_options.ClusterNetworkID = core.StringPtr(clusterNetworkID)
return _options
}
// SetName : Allow user to set Name
func (_options *CreateClusterNetworkInterfaceOptions) SetName(name string) *CreateClusterNetworkInterfaceOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetPrimaryIP : Allow user to set PrimaryIP
func (_options *CreateClusterNetworkInterfaceOptions) SetPrimaryIP(primaryIP ClusterNetworkInterfacePrimaryIPPrototypeIntf) *CreateClusterNetworkInterfaceOptions {
_options.PrimaryIP = primaryIP
return _options
}
// SetSubnet : Allow user to set Subnet
func (_options *CreateClusterNetworkInterfaceOptions) SetSubnet(subnet ClusterNetworkSubnetIdentityIntf) *CreateClusterNetworkInterfaceOptions {
_options.Subnet = subnet
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateClusterNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateClusterNetworkInterfaceOptions {
options.Headers = param
return options
}
// CreateClusterNetworkOptions : The CreateClusterNetwork options.
type CreateClusterNetworkOptions struct {
// The profile to use for this cluster network.
Profile ClusterNetworkProfileIdentityIntf `json:"profile" validate:"required"`
// The VPC this cluster network will reside in.
VPC VPCIdentityIntf `json:"vpc" validate:"required"`
// The zone this cluster network will reside in. The zone must be listed
// as supported on the specified cluster network profile.
Zone ZoneIdentityIntf `json:"zone" validate:"required"`
// The name for this cluster network. The name must not be used by another cluster network in the region. Names
// starting with `ibm-` are reserved for provider-owned resources, and 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
SubnetPrefixes []ClusterNetworkSubnetPrefixPrototype `json:"subnet_prefixes,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateClusterNetworkOptions : Instantiate CreateClusterNetworkOptions
func (*VpcV1) NewCreateClusterNetworkOptions(profile ClusterNetworkProfileIdentityIntf, vpc VPCIdentityIntf, zone ZoneIdentityIntf) *CreateClusterNetworkOptions {
return &CreateClusterNetworkOptions{
Profile: profile,
VPC: vpc,
Zone: zone,
}
}
// SetProfile : Allow user to set Profile
func (_options *CreateClusterNetworkOptions) SetProfile(profile ClusterNetworkProfileIdentityIntf) *CreateClusterNetworkOptions {
_options.Profile = profile
return _options
}
// SetVPC : Allow user to set VPC
func (_options *CreateClusterNetworkOptions) SetVPC(vpc VPCIdentityIntf) *CreateClusterNetworkOptions {
_options.VPC = vpc
return _options
}
// SetZone : Allow user to set Zone
func (_options *CreateClusterNetworkOptions) SetZone(zone ZoneIdentityIntf) *CreateClusterNetworkOptions {
_options.Zone = zone
return _options
}
// SetName : Allow user to set Name
func (_options *CreateClusterNetworkOptions) SetName(name string) *CreateClusterNetworkOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetResourceGroup : Allow user to set ResourceGroup
func (_options *CreateClusterNetworkOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateClusterNetworkOptions {
_options.ResourceGroup = resourceGroup
return _options
}
// SetSubnetPrefixes : Allow user to set SubnetPrefixes
func (_options *CreateClusterNetworkOptions) SetSubnetPrefixes(subnetPrefixes []ClusterNetworkSubnetPrefixPrototype) *CreateClusterNetworkOptions {
_options.SubnetPrefixes = subnetPrefixes
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateClusterNetworkOptions) SetHeaders(param map[string]string) *CreateClusterNetworkOptions {
options.Headers = param
return options
}
// CreateClusterNetworkSubnetOptions : The CreateClusterNetworkSubnet options.
type CreateClusterNetworkSubnetOptions struct {
// The cluster network identifier.
ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="`
// The cluster network subnet prototype object.
ClusterNetworkSubnetPrototype ClusterNetworkSubnetPrototypeIntf `json:"ClusterNetworkSubnetPrototype" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateClusterNetworkSubnetOptions : Instantiate CreateClusterNetworkSubnetOptions
func (*VpcV1) NewCreateClusterNetworkSubnetOptions(clusterNetworkID string, clusterNetworkSubnetPrototype ClusterNetworkSubnetPrototypeIntf) *CreateClusterNetworkSubnetOptions {
return &CreateClusterNetworkSubnetOptions{
ClusterNetworkID: core.StringPtr(clusterNetworkID),
ClusterNetworkSubnetPrototype: clusterNetworkSubnetPrototype,
}
}
// SetClusterNetworkID : Allow user to set ClusterNetworkID
func (_options *CreateClusterNetworkSubnetOptions) SetClusterNetworkID(clusterNetworkID string) *CreateClusterNetworkSubnetOptions {
_options.ClusterNetworkID = core.StringPtr(clusterNetworkID)
return _options
}
// SetClusterNetworkSubnetPrototype : Allow user to set ClusterNetworkSubnetPrototype
func (_options *CreateClusterNetworkSubnetOptions) SetClusterNetworkSubnetPrototype(clusterNetworkSubnetPrototype ClusterNetworkSubnetPrototypeIntf) *CreateClusterNetworkSubnetOptions {
_options.ClusterNetworkSubnetPrototype = clusterNetworkSubnetPrototype
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateClusterNetworkSubnetOptions) SetHeaders(param map[string]string) *CreateClusterNetworkSubnetOptions {
options.Headers = param
return options
}
// CreateClusterNetworkSubnetReservedIPOptions : The CreateClusterNetworkSubnetReservedIP options.
type CreateClusterNetworkSubnetReservedIPOptions struct {
// The cluster network identifier.
ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="`
// The cluster network subnet identifier.
ClusterNetworkSubnetID *string `json:"cluster_network_subnet_id" validate:"required,ne="`
// The IP address to reserve, which must not already be reserved on the subnet.
//
// If unspecified, an available address on the subnet will automatically be selected.
Address *string `json:"address,omitempty"`
// The name for this cluster network subnet reserved IP. The name must not be used by another reserved IP in the
// cluster network subnet. Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed.
// If unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateClusterNetworkSubnetReservedIPOptions : Instantiate CreateClusterNetworkSubnetReservedIPOptions
func (*VpcV1) NewCreateClusterNetworkSubnetReservedIPOptions(clusterNetworkID string, clusterNetworkSubnetID string) *CreateClusterNetworkSubnetReservedIPOptions {
return &CreateClusterNetworkSubnetReservedIPOptions{
ClusterNetworkID: core.StringPtr(clusterNetworkID),
ClusterNetworkSubnetID: core.StringPtr(clusterNetworkSubnetID),
}
}
// SetClusterNetworkID : Allow user to set ClusterNetworkID
func (_options *CreateClusterNetworkSubnetReservedIPOptions) SetClusterNetworkID(clusterNetworkID string) *CreateClusterNetworkSubnetReservedIPOptions {
_options.ClusterNetworkID = core.StringPtr(clusterNetworkID)
return _options
}
// SetClusterNetworkSubnetID : Allow user to set ClusterNetworkSubnetID
func (_options *CreateClusterNetworkSubnetReservedIPOptions) SetClusterNetworkSubnetID(clusterNetworkSubnetID string) *CreateClusterNetworkSubnetReservedIPOptions {
_options.ClusterNetworkSubnetID = core.StringPtr(clusterNetworkSubnetID)
return _options
}
// SetAddress : Allow user to set Address
func (_options *CreateClusterNetworkSubnetReservedIPOptions) SetAddress(address string) *CreateClusterNetworkSubnetReservedIPOptions {
_options.Address = core.StringPtr(address)
return _options
}
// SetName : Allow user to set Name
func (_options *CreateClusterNetworkSubnetReservedIPOptions) SetName(name string) *CreateClusterNetworkSubnetReservedIPOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateClusterNetworkSubnetReservedIPOptions) SetHeaders(param map[string]string) *CreateClusterNetworkSubnetReservedIPOptions {
options.Headers = param
return options
}
// CreateDedicatedHostGroupOptions : The CreateDedicatedHostGroup options.
type CreateDedicatedHostGroupOptions struct {
// The dedicated host profile class for hosts in this group.
Class *string `json:"class" validate:"required"`
// The dedicated host profile family for hosts in this group.
Family *string `json:"family" validate:"required"`
// The zone this dedicated host group will reside in.
Zone ZoneIdentityIntf `json:"zone" validate:"required"`
// The name for this dedicated host group. The name must not be used by another dedicated host group in the region. 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// 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(class string, family string, zone ZoneIdentityIntf) *CreateDedicatedHostGroupOptions {
return &CreateDedicatedHostGroupOptions{
Class: core.StringPtr(class),
Family: core.StringPtr(family),
Zone: zone,
}
}
// 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
}
// SetZone : Allow user to set Zone
func (_options *CreateDedicatedHostGroupOptions) SetZone(zone ZoneIdentityIntf) *CreateDedicatedHostGroupOptions {
_options.Zone = zone
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
}
// 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 `json:"DedicatedHostPrototype" 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 to use for this endpoint gateway. The target:
// - Must not already be the target of another endpoint gateway in the VPC
// - Must not have a service endpoint that overlaps with any `service_endpoints` of
// another endpoint gateway in the VPC.
//
// If `allow_dns_resolution_binding` is `true`, then there must not be another endpoint
// gateway with `allow_dns_resolution_binding` set to `true` in the [DNS
// sharing](/docs/vpc?topic=vpc-vpe-dns-sharing) connected topology that:
// - Has the same `target` as this endpoint gateway
// - Has `service_endpoints` that overlap with the `service_endpoints` for this endpoint
// gateway.
Target EndpointGatewayTargetPrototypeIntf `json:"target" validate:"required"`
// The VPC this endpoint gateway will reside in.
VPC VPCIdentityIntf `json:"vpc" validate:"required"`
// Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in
// has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`.
//
// If `true`, then there must not be another endpoint gateway with
// `allow_dns_resolution_binding` set to `true` in the [DNS sharing](/docs/vpc?topic=vpc-vpe-dns-sharing) connected
// topology that:
// - Has the same `target` as this endpoint gateway
// - Has `service_endpoints` that overlap with the `service_endpoints` for this endpoint
// gateway.
//
// Must be `true` if the VPC this endpoint gateway resides in has `dns.enable_hub` set to
// `true`.
AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"`
// The reserved IPs to bind to this endpoint gateway. At most one reserved IP per zone is allowed.
Ips []EndpointGatewayReservedIPIntf `json:"ips,omitempty"`
// The name for this endpoint gateway. The name must not be used by another endpoint gateway in the VPC. 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The security groups to use for this endpoint gateway. If unspecified, the VPC's default security group is used.
SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"`
// 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
}
// SetAllowDnsResolutionBinding : Allow user to set AllowDnsResolutionBinding
func (_options *CreateEndpointGatewayOptions) SetAllowDnsResolutionBinding(allowDnsResolutionBinding bool) *CreateEndpointGatewayOptions {
_options.AllowDnsResolutionBinding = core.BoolPtr(allowDnsResolutionBinding)
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
}
// SetSecurityGroups : Allow user to set SecurityGroups
func (_options *CreateEndpointGatewayOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateEndpointGatewayOptions {
_options.SecurityGroups = securityGroups
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 `json:"FloatingIPPrototype" 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. For more information, see [Creating a flow log
// collector](https://cloud.ibm.com/docs/vpc?topic=vpc-ordering-flow-log-collector).
StorageBucket LegacyCloudObjectStorageBucketIdentityIntf `json:"storage_bucket" 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
// instance network attachments, virtual network interfaces or instance network interfaces
// within the target that are themselves the target of a more specific flow log collector.
//
// The target must not be a virtual network interface that is attached to a bare metal server
// network attachment or to a file share mount target.
Target FlowLogCollectorTargetPrototypeIntf `json:"target" validate:"required"`
// Indicates whether this collector will be active upon creation.
Active *bool `json:"active,omitempty"`
// The name for this flow log collector. The name must not be used by another flow log collector in the VPC. 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateFlowLogCollectorOptions : Instantiate CreateFlowLogCollectorOptions
func (*VpcV1) NewCreateFlowLogCollectorOptions(storageBucket LegacyCloudObjectStorageBucketIdentityIntf, target FlowLogCollectorTargetPrototypeIntf) *CreateFlowLogCollectorOptions {
return &CreateFlowLogCollectorOptions{
StorageBucket: storageBucket,
Target: target,
}
}
// SetStorageBucket : Allow user to set StorageBucket
func (_options *CreateFlowLogCollectorOptions) SetStorageBucket(storageBucket LegacyCloudObjectStorageBucketIdentityIntf) *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 `json:"authentication_algorithm" 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 protocol version.
IkeVersion *int64 `json:"ike_version" validate:"required"`
// The key lifetime in seconds.
KeyLifetime *int64 `json:"key_lifetime,omitempty"`
// The name for this IKE policy. The name must not be used by another IKE policies in the region. 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the CreateIkePolicyOptions.AuthenticationAlgorithm property.
// The authentication algorithm.
const (
CreateIkePolicyOptionsAuthenticationAlgorithmSha256Const = "sha256"
CreateIkePolicyOptionsAuthenticationAlgorithmSha384Const = "sha384"
CreateIkePolicyOptionsAuthenticationAlgorithmSha512Const = "sha512"
)
// Constants associated with the CreateIkePolicyOptions.EncryptionAlgorithm property.
// The encryption algorithm.
const (
CreateIkePolicyOptionsEncryptionAlgorithmAes128Const = "aes128"
CreateIkePolicyOptionsEncryptionAlgorithmAes192Const = "aes192"
CreateIkePolicyOptionsEncryptionAlgorithmAes256Const = "aes256"
)
// 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
}
// CreateImageExportJobOptions : The CreateImageExportJob options.
type CreateImageExportJobOptions struct {
// The image identifier.
ImageID *string `json:"image_id" validate:"required,ne="`
// The Cloud Object Storage bucket to export the image to. The bucket must exist and an IAM
// service authorization must grant `Image Service for VPC` of
// `VPC Infrastructure Services` writer access to the bucket.
StorageBucket CloudObjectStorageBucketIdentityIntf `json:"storage_bucket" validate:"required"`
// The format to use for the exported image. If the image is encrypted, only `qcow2` is supported.
Format *string `json:"format,omitempty"`
// The name for this image export job. The name must not be used by another export job for the image. If unspecified,
// the name will be a hyphenated list of randomly-selected words prefixed with the first 16 characters of the parent
// image name.
//
// The exported image object name in Cloud Object Storage (`storage_object.name` in the response) will be based on this
// name. The object name will be unique within the bucket.
Name *string `json:"name,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the CreateImageExportJobOptions.Format property.
// The format to use for the exported image. If the image is encrypted, only `qcow2` is supported.
const (
CreateImageExportJobOptionsFormatQcow2Const = "qcow2"
CreateImageExportJobOptionsFormatVhdConst = "vhd"
)
// NewCreateImageExportJobOptions : Instantiate CreateImageExportJobOptions
func (*VpcV1) NewCreateImageExportJobOptions(imageID string, storageBucket CloudObjectStorageBucketIdentityIntf) *CreateImageExportJobOptions {
return &CreateImageExportJobOptions{
ImageID: core.StringPtr(imageID),
StorageBucket: storageBucket,
}
}
// SetImageID : Allow user to set ImageID
func (_options *CreateImageExportJobOptions) SetImageID(imageID string) *CreateImageExportJobOptions {
_options.ImageID = core.StringPtr(imageID)
return _options
}
// SetStorageBucket : Allow user to set StorageBucket
func (_options *CreateImageExportJobOptions) SetStorageBucket(storageBucket CloudObjectStorageBucketIdentityIntf) *CreateImageExportJobOptions {
_options.StorageBucket = storageBucket
return _options
}
// SetFormat : Allow user to set Format
func (_options *CreateImageExportJobOptions) SetFormat(format string) *CreateImageExportJobOptions {
_options.Format = core.StringPtr(format)
return _options
}
// SetName : Allow user to set Name
func (_options *CreateImageExportJobOptions) SetName(name string) *CreateImageExportJobOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateImageExportJobOptions) SetHeaders(param map[string]string) *CreateImageExportJobOptions {
options.Headers = param
return options
}
// CreateImageOptions : The CreateImage options.
type CreateImageOptions struct {
// The image prototype object.
ImagePrototype ImagePrototypeIntf `json:"ImagePrototype" 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 virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The type of action.
Type *string `json:"type" 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"`
// 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 virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance console type for which this token may be used.
ConsoleType *string `json:"console_type" 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,omitempty"`
// 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
}
// CreateInstanceGroupManagerActionOptions : The CreateInstanceGroupManagerAction options.
type CreateInstanceGroupManagerActionOptions struct {
// The instance group identifier.
InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="`
// The instance group manager identifier.
InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="`
// The instance group manager action prototype object.
InstanceGroupManagerActionPrototype InstanceGroupManagerActionPrototypeIntf `json:"InstanceGroupManagerActionPrototype" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateInstanceGroupManagerActionOptions : Instantiate CreateInstanceGroupManagerActionOptions
func (*VpcV1) NewCreateInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, instanceGroupManagerActionPrototype InstanceGroupManagerActionPrototypeIntf) *CreateInstanceGroupManagerActionOptions {
return &CreateInstanceGroupManagerActionOptions{
InstanceGroupID: core.StringPtr(instanceGroupID),
InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID),
InstanceGroupManagerActionPrototype: instanceGroupManagerActionPrototype,
}
}
// SetInstanceGroupID : Allow user to set InstanceGroupID
func (_options *CreateInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *CreateInstanceGroupManagerActionOptions {
_options.InstanceGroupID = core.StringPtr(instanceGroupID)
return _options
}
// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID
func (_options *CreateInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *CreateInstanceGroupManagerActionOptions {
_options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID)
return _options
}
// SetInstanceGroupManagerActionPrototype : Allow user to set InstanceGroupManagerActionPrototype
func (_options *CreateInstanceGroupManagerActionOptions) SetInstanceGroupManagerActionPrototype(instanceGroupManagerActionPrototype InstanceGroupManagerActionPrototypeIntf) *CreateInstanceGroupManagerActionOptions {
_options.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototype
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *CreateInstanceGroupManagerActionOptions {
options.Headers = param
return options
}
// CreateInstanceGroupManagerOptions : The CreateInstanceGroupManager options.
type CreateInstanceGroupManagerOptions struct {
// The instance group identifier.
InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="`
// The instance group manager prototype object.
InstanceGroupManagerPrototype InstanceGroupManagerPrototypeIntf `json:"InstanceGroupManagerPrototype" 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 `json:"instance_group_id" validate:"required,ne="`
// The instance group manager identifier.
InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="`
// The instance group manager policy prototype object.
InstanceGroupManagerPolicyPrototype InstanceGroupManagerPolicyPrototypeIntf `json:"InstanceGroupManagerPolicyPrototype" 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 {
// The instance template to use when creating new instances.
//
// The specified template must not have `default_trusted_profile.auto_link` set to `true`.
InstanceTemplate InstanceTemplateIdentityIntf `json:"instance_template" validate:"required"`
// The subnets to use when creating new instances.
Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"`
// The port to use for new load balancer pool members created by this instance group. The load balancer pool member
// will receive load balancer traffic on this port, unless the load balancer listener is using a port range. (Traffic
// received on a listener using a port range will be sent to members using the same port the listener received it on.)
//
// This port will also be used for health checks unless the port property of
// `health_monitor` property is specified.
//
// This property must be specified if and only if `load_balancer_pool` has been specified.
ApplicationPort *int64 `json:"application_port,omitempty"`
// The load balancer associated with the specified load balancer pool.
// Required if `load_balancer_pool` is specified. The load balancer must have
// `instance_groups_supported` set to `true`.
LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"`
// If specified, this instance group will manage the load balancer pool. A pool member
// will be created for each instance created by this group. The specified load
// balancer pool must not be used by another instance group in the VPC.
//
// If specified, `load_balancer` and `application_port` must also be specified.
LoadBalancerPool LoadBalancerPoolIdentityIntf `json:"load_balancer_pool,omitempty"`
// The number of instances in the instance group.
MembershipCount *int64 `json:"membership_count,omitempty"`
// The name for this instance group. The name must not be used by another instance group in the region. 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// 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
}
// CreateInstanceNetworkAttachmentOptions : The CreateInstanceNetworkAttachment options.
type CreateInstanceNetworkAttachmentOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// A virtual network interface for the instance network attachment. This can be specified
// using an existing virtual network interface, or a prototype object for a new virtual
// network interface.
//
// If an existing virtual network interface is specified, `enable_infrastructure_nat` must be
// `true`.
VirtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"`
// The name for this network attachment. Names must be unique within the instance the network attachment resides in. If
// unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateInstanceNetworkAttachmentOptions : Instantiate CreateInstanceNetworkAttachmentOptions
func (*VpcV1) NewCreateInstanceNetworkAttachmentOptions(instanceID string, virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) *CreateInstanceNetworkAttachmentOptions {
return &CreateInstanceNetworkAttachmentOptions{
InstanceID: core.StringPtr(instanceID),
VirtualNetworkInterface: virtualNetworkInterface,
}
}
// SetInstanceID : Allow user to set InstanceID
func (_options *CreateInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *CreateInstanceNetworkAttachmentOptions {
_options.InstanceID = core.StringPtr(instanceID)
return _options
}
// SetVirtualNetworkInterface : Allow user to set VirtualNetworkInterface
func (_options *CreateInstanceNetworkAttachmentOptions) SetVirtualNetworkInterface(virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) *CreateInstanceNetworkAttachmentOptions {
_options.VirtualNetworkInterface = virtualNetworkInterface
return _options
}
// SetName : Allow user to set Name
func (_options *CreateInstanceNetworkAttachmentOptions) SetName(name string) *CreateInstanceNetworkAttachmentOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *CreateInstanceNetworkAttachmentOptions {
options.Headers = param
return options
}
// CreateInstanceNetworkInterfaceOptions : The CreateInstanceNetworkInterface options.
type CreateInstanceNetworkInterfaceOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The associated subnet.
Subnet SubnetIdentityIntf `json:"subnet" validate:"required"`
// Indicates whether source IP spoofing is allowed on this instance network interface.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on
// the attached virtual network interface.
AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"`
// The name for the instance network interface. The name must not be used by another network interface on the virtual
// server instance. If unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The primary IP address to bind to the instance network interface. This can be
// specified using an existing reserved IP, or a prototype object for a new reserved IP.
//
// If an existing reserved IP or a prototype object with an address is specified, it must
// be available on the instance network interface's subnet. Otherwise, an
// available address on the subnet will be automatically selected and reserved.
PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"`
// The security groups to use for this instance network interface. If unspecified, the VPC's default security group is
// used.
SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"`
// 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
}
// SetPrimaryIP : Allow user to set PrimaryIP
func (_options *CreateInstanceNetworkInterfaceOptions) SetPrimaryIP(primaryIP NetworkInterfaceIPPrototypeIntf) *CreateInstanceNetworkInterfaceOptions {
_options.PrimaryIP = primaryIP
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 `json:"InstancePrototype" 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 `json:"InstanceTemplatePrototype" 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 virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The volume to use for this attachment. This can be specified as an existing unattached
// volume, or a prototype object for a new volume.
Volume VolumeAttachmentPrototypeVolumeIntf `json:"volume" validate:"required"`
// Indicates whether deleting the instance will also delete the attached volume.
DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"`
// The name for this volume attachment. The name must not be used by another volume attachment on the instance. If
// unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateInstanceVolumeAttachmentOptions : Instantiate CreateInstanceVolumeAttachmentOptions
func (*VpcV1) NewCreateInstanceVolumeAttachmentOptions(instanceID string, volume VolumeAttachmentPrototypeVolumeIntf) *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 VolumeAttachmentPrototypeVolumeIntf) *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
//
// Must be `disabled` if and only if the `encryption_algorithm` is `aes128gcm16`,
// `aes192gcm16`, or `aes256gcm16`
//
// The `md5` and `sha1` algorithms have been deprecated.
AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"`
// The encryption algorithm
//
// The `authentication_algorithm` must be `disabled` if and only if
// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`
//
// The `triple_des` algorithm has been deprecated.
EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"`
// The Perfect Forward Secrecy group.
//
// Groups `group_2` and `group_5` have been deprecated.
Pfs *string `json:"pfs" validate:"required"`
// The key lifetime in seconds.
KeyLifetime *int64 `json:"key_lifetime,omitempty"`
// The name for this IPsec policy. The name must not be used by another IPsec policies in the region. 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the CreateIpsecPolicyOptions.AuthenticationAlgorithm property.
// The authentication algorithm
//
// Must be `disabled` if and only if the `encryption_algorithm` is `aes128gcm16`,
// `aes192gcm16`, or `aes256gcm16`
//
// The `md5` and `sha1` algorithms have been deprecated.
const (
CreateIpsecPolicyOptionsAuthenticationAlgorithmDisabledConst = "disabled"
CreateIpsecPolicyOptionsAuthenticationAlgorithmSha256Const = "sha256"
CreateIpsecPolicyOptionsAuthenticationAlgorithmSha384Const = "sha384"
CreateIpsecPolicyOptionsAuthenticationAlgorithmSha512Const = "sha512"
)
// Constants associated with the CreateIpsecPolicyOptions.EncryptionAlgorithm property.
// The encryption algorithm
//
// The `authentication_algorithm` must be `disabled` if and only if
// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`
//
// The `triple_des` algorithm has been deprecated.
const (
CreateIpsecPolicyOptionsEncryptionAlgorithmAes128Const = "aes128"
CreateIpsecPolicyOptionsEncryptionAlgorithmAes128gcm16Const = "aes128gcm16"
CreateIpsecPolicyOptionsEncryptionAlgorithmAes192Const = "aes192"
CreateIpsecPolicyOptionsEncryptionAlgorithmAes192gcm16Const = "aes192gcm16"
CreateIpsecPolicyOptionsEncryptionAlgorithmAes256Const = "aes256"
CreateIpsecPolicyOptionsEncryptionAlgorithmAes256gcm16Const = "aes256gcm16"
)
// Constants associated with the CreateIpsecPolicyOptions.Pfs property.
// The Perfect Forward Secrecy group.
//
// Groups `group_2` and `group_5` have been deprecated.
const (
CreateIpsecPolicyOptionsPfsDisabledConst = "disabled"
CreateIpsecPolicyOptionsPfsGroup14Const = "group_14"
CreateIpsecPolicyOptionsPfsGroup15Const = "group_15"
CreateIpsecPolicyOptionsPfsGroup16Const = "group_16"
CreateIpsecPolicyOptionsPfsGroup17Const = "group_17"
CreateIpsecPolicyOptionsPfsGroup18Const = "group_18"
CreateIpsecPolicyOptionsPfsGroup19Const = "group_19"
CreateIpsecPolicyOptionsPfsGroup20Const = "group_20"
CreateIpsecPolicyOptionsPfsGroup21Const = "group_21"
CreateIpsecPolicyOptionsPfsGroup22Const = "group_22"
CreateIpsecPolicyOptionsPfsGroup23Const = "group_23"
CreateIpsecPolicyOptionsPfsGroup24Const = "group_24"
CreateIpsecPolicyOptionsPfsGroup31Const = "group_31"
)
// 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 {
// The public SSH key to use, in OpenSSH format (consisting of three space-separated fields: the algorithm name,
// base64-encoded key value, and a comment). The algorithm and comment fields may be omitted, as only the key field is
// used.
//
// The key field must not match another key in the region.
//
// Keys of type `rsa` must be 2048 or 4096 bits in length (4096 is recommended). Keys of type `ed25519` must be 256
// bits in length.
PublicKey *string `json:"public_key" validate:"required"`
// The name for this key. The name must not be used by another key in the region. 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The crypto-system for this key.
Type *string `json:"type,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the CreateKeyOptions.Type property.
// The crypto-system for this key.
const (
CreateKeyOptionsTypeEd25519Const = "ed25519"
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 `json:"load_balancer_id" validate:"required,ne="`
// The listener protocol. Each listener in the load balancer must have a non-overlapping port range and `protocol`
// combination.
//
// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the
// `application` family support `tcp`, `http` and
// `https`.
//
// Additional restrictions:
// - If `default_pool` is set, the pool's protocol must match, or be compatible with
// the listener's protocol. At present, the compatible protocols are `http` and
// `https`.
// - If `https_redirect` is set, the protocol must be `http`.
Protocol *string `json:"protocol" 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`). Additional restrictions:
// - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must
// match the `accept_proxy_protocol` value of the `https_redirect` listener.
// - If this listener is the target of another listener's `https_redirect`, its
// `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value.
AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"`
// The certificate instance to use for SSL termination. The listener must have a
// `protocol` of `https`.
CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"`
// The concurrent connection limit for the listener. If reached, incoming connections may be queued or rejected.
//
// Supported for load balancers in the `application` family.
//
// If unspecified, the limit will be `15000` for load balancers in the `application` family.
ConnectionLimit *int64 `json:"connection_limit,omitempty"`
// The default pool for this listener. If `https_redirect` is specified, the
// default pool will not be used.
// If specified, the pool must:
//
// - Belong to this load balancer.
// - Have the same `protocol` as this listener, or have a compatible protocol.
// At present, the compatible protocols are `http` and `https`.
// - Not already be the `default_pool` for another listener.
//
// If unspecified, this listener will be created with no default pool, but one may be
// subsequently set.
DefaultPool LoadBalancerPoolIdentityIntf `json:"default_pool,omitempty"`
// The target listener that requests will be redirected to if none of the listener's
// `policies` match.
//
// If specified, this listener must have a `protocol` of `http`, and the target
// listener must have a `protocol` of `https`.
HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPrototype `json:"https_redirect,omitempty"`
// The idle connection timeout of the listener in seconds.
//
// Supported for load balancers in the `application` family.
//
// If unspecified, the timeout will be `50` for load balancers in the `application` family.
IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"`
// The policy prototype objects for this listener. The load balancer must be in the
// `application` family.
Policies []LoadBalancerListenerPolicyPrototype `json:"policies,omitempty"`
// The listener port number. Each listener in the load balancer must have a non-overlapping port range and `protocol`
// combination. Protocol values of `tcp`, `http` and `https` share the TCP port space.
//
// If `port_min` is also specified, `port` must have the same value as `port_min`.
Port *int64 `json:"port,omitempty"`
// The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`.
//
// Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to
// `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be
// `65535`.
//
// The specified port range must not overlap with port ranges used by other listeners for this load balancer using the
// same protocol. Protocol values of `tcp`, `http` and
// `https` share the TCP port space.
PortMax *int64 `json:"port_max,omitempty"`
// The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`.
//
// If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be
// unspecified.
//
// If `port` is also specified, `port_min` must have the same value as `port`.
//
// Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to
// `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be
// `1`.
//
// The specified port range must not overlap with port ranges used by other listeners for this load balancer using the
// same protocol. Protocol values of `tcp`, `http` and
// `https` share the TCP port space.
PortMin *int64 `json:"port_min,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the CreateLoadBalancerListenerOptions.Protocol property.
// The listener protocol. Each listener in the load balancer must have a non-overlapping port range and `protocol`
// combination.
//
// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the
// `application` family support `tcp`, `http` and
// `https`.
//
// Additional restrictions:
// - If `default_pool` is set, the pool's protocol must match, or be compatible with
// the listener's protocol. At present, the compatible protocols are `http` and
// `https`.
// - If `https_redirect` is set, the protocol must be `http`.
const (
CreateLoadBalancerListenerOptionsProtocolHTTPConst = "http"
CreateLoadBalancerListenerOptionsProtocolHTTPSConst = "https"
CreateLoadBalancerListenerOptionsProtocolTCPConst = "tcp"
CreateLoadBalancerListenerOptionsProtocolUDPConst = "udp"
)
// NewCreateLoadBalancerListenerOptions : Instantiate CreateLoadBalancerListenerOptions
func (*VpcV1) NewCreateLoadBalancerListenerOptions(loadBalancerID string, protocol string) *CreateLoadBalancerListenerOptions {
return &CreateLoadBalancerListenerOptions{
LoadBalancerID: core.StringPtr(loadBalancerID),
Protocol: core.StringPtr(protocol),
}
}
// SetLoadBalancerID : Allow user to set LoadBalancerID
func (_options *CreateLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerOptions {
_options.LoadBalancerID = core.StringPtr(loadBalancerID)
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
}
// SetHTTPSRedirect : Allow user to set HTTPSRedirect
func (_options *CreateLoadBalancerListenerOptions) SetHTTPSRedirect(httpsRedirect *LoadBalancerListenerHTTPSRedirectPrototype) *CreateLoadBalancerListenerOptions {
_options.HTTPSRedirect = httpsRedirect
return _options
}
// SetIdleConnectionTimeout : Allow user to set IdleConnectionTimeout
func (_options *CreateLoadBalancerListenerOptions) SetIdleConnectionTimeout(idleConnectionTimeout int64) *CreateLoadBalancerListenerOptions {
_options.IdleConnectionTimeout = core.Int64Ptr(idleConnectionTimeout)
return _options
}
// SetPolicies : Allow user to set Policies
func (_options *CreateLoadBalancerListenerOptions) SetPolicies(policies []LoadBalancerListenerPolicyPrototype) *CreateLoadBalancerListenerOptions {
_options.Policies = policies
return _options
}
// SetPort : Allow user to set Port
func (_options *CreateLoadBalancerListenerOptions) SetPort(port int64) *CreateLoadBalancerListenerOptions {
_options.Port = core.Int64Ptr(port)
return _options
}
// SetPortMax : Allow user to set PortMax
func (_options *CreateLoadBalancerListenerOptions) SetPortMax(portMax int64) *CreateLoadBalancerListenerOptions {
_options.PortMax = core.Int64Ptr(portMax)
return _options
}
// SetPortMin : Allow user to set PortMin
func (_options *CreateLoadBalancerListenerOptions) SetPortMin(portMin int64) *CreateLoadBalancerListenerOptions {
_options.PortMin = core.Int64Ptr(portMin)
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 `json:"load_balancer_id" validate:"required,ne="`
// The listener identifier.
ListenerID *string `json:"listener_id" validate:"required,ne="`
// The policy action:
// - `forward_to_listener`: Requests will be forwarded to the specified
// `target` listener.
// - `forward_to_pool`: Requests will be forwarded to the specified `target` pool.
// - `https_redirect`: Requests will be redirected to the specified `target.listener`.
// This listener must have a `protocol` of `http`, and the target listener must
// have a `protocol` of `https`.
// - `redirect`: Requests will be redirected to the specified `target.url`
// - `reject`: Requests will be rejected with a `403` status code.
Action *string `json:"action" validate:"required"`
// The priority of the policy. The priority is unique across all policies for this load balancer listener. Lower value
// indicates higher priority.
Priority *int64 `json:"priority" validate:"required"`
// The name for this policy. The name must not be used by another policy for the load balancer listener. If
// unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The rule prototype objects for this policy.
Rules []LoadBalancerListenerPolicyRulePrototype `json:"rules,omitempty"`
// - If `action` is `forward_to_listener`, specify a `LoadBalancerListenerIdentity` in this
// load balancer to forward to.
// - If `action` is `forward_to_pool`, use `LoadBalancerPoolIdentity` to specify a pool in
// this load balancer to forward to.
// - If `action` is `https_redirect`, use
// `LoadBalancerListenerPolicyHTTPSRedirectPrototype` to specify a listener on this
// load balancer to redirect to.
// - If `action` is `redirect`, use `LoadBalancerListenerPolicyRedirectURLPrototype`to
// specify a URL to redirect to.
Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the CreateLoadBalancerListenerPolicyOptions.Action property.
// The policy action:
// - `forward_to_listener`: Requests will be forwarded to the specified
// `target` listener.
// - `forward_to_pool`: Requests will be forwarded to the specified `target` pool.
// - `https_redirect`: Requests will be redirected to the specified `target.listener`.
// This listener must have a `protocol` of `http`, and the target listener must
// have a `protocol` of `https`.
// - `redirect`: Requests will be redirected to the specified `target.url`
// - `reject`: Requests will be rejected with a `403` status code.
const (
CreateLoadBalancerListenerPolicyOptionsActionForwardToListenerConst = "forward_to_listener"
CreateLoadBalancerListenerPolicyOptionsActionForwardToPoolConst = "forward_to_pool"
CreateLoadBalancerListenerPolicyOptionsActionHTTPSRedirectConst = "https_redirect"
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 `json:"load_balancer_id" validate:"required,ne="`
// The listener identifier.
ListenerID *string `json:"listener_id" validate:"required,ne="`
// The policy identifier.
PolicyID *string `json:"policy_id" validate:"required,ne="`
// The condition for the rule.
Condition *string `json:"condition" validate:"required"`
// The content the rule applies to:
// - `body`: The UTF-8 form-encoded HTTP request body
// - `header`: The HTTP header
// - `hostname`: The fully-qualified domain name of the server specified in the Host
// HTTP request header
// - `path`: The path of the HTTP request
// - `query`: The query of the HTTP request URL
// - `sni_hostname`: The fully-qualified domain name of the server provided in the
// "server name indicator" extension during TLS negotiation
//
// - For listeners with `protocol` `http` or `https`, any type may be specified.
// - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified.
Type *string `json:"type" validate:"required"`
// The value to be matched for the 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"`
// The field to match for this rule.
// - If the `type` is `header`, this property must be specified.
// - If the `type` is `body` or `query`, this property may be specified.
// - For all other types, this property must not be specified.
Field *string `json:"field,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Condition property.
// The condition for the rule.
const (
CreateLoadBalancerListenerPolicyRuleOptionsConditionContainsConst = "contains"
CreateLoadBalancerListenerPolicyRuleOptionsConditionEqualsConst = "equals"
CreateLoadBalancerListenerPolicyRuleOptionsConditionMatchesRegexConst = "matches_regex"
)
// Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Type property.
// The content the rule applies to:
// - `body`: The UTF-8 form-encoded HTTP request body
// - `header`: The HTTP header
// - `hostname`: The fully-qualified domain name of the server specified in the Host
// HTTP request header
// - `path`: The path of the HTTP request
// - `query`: The query of the HTTP request URL
// - `sni_hostname`: The fully-qualified domain name of the server provided in the
// "server name indicator" extension during TLS negotiation
//
// - For listeners with `protocol` `http` or `https`, any type may be specified.
// - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified.
const (
CreateLoadBalancerListenerPolicyRuleOptionsTypeBodyConst = "body"
CreateLoadBalancerListenerPolicyRuleOptionsTypeHeaderConst = "header"
CreateLoadBalancerListenerPolicyRuleOptionsTypeHostnameConst = "hostname"
CreateLoadBalancerListenerPolicyRuleOptionsTypePathConst = "path"
CreateLoadBalancerListenerPolicyRuleOptionsTypeQueryConst = "query"
CreateLoadBalancerListenerPolicyRuleOptionsTypeSniHostnameConst = "sni_hostname"
)
// 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.
//
// At present,
// - If `route_mode` is set to `true`, the load balancer must be private.
// - If `is_private_path` is specified, it must be set to `false`.
IsPublic *bool `json:"is_public" validate:"required"`
// The subnets to provision this load balancer in. The subnets must be in the same VPC.
// - If 'availability' is specified as `subnet` in the profile, the load balancer's availability will depend on the
// availability of the zones that the subnets reside in.
// - If 'availability' is specified as `region` in the profile, the load balancer remains available as long as any zone
// in the region is available. Only members in healthy zones will be sent new connections.
//
// Load balancers in the `network` family allow only one subnet to be specified.
Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"`
// The DNS configuration for this load balancer.
//
// If unspecified, DNS `A` records for this load balancer's `hostname` property will be added
// to the public DNS zone `lb.appdomain.cloud`. Otherwise, those DNS `A` records will be
// added to the specified `zone`.
//
// Not supported by private path load balancers.
Dns *LoadBalancerDnsPrototype `json:"dns,omitempty"`
// Indicates whether this is a private path load balancer.
IsPrivatePath *bool `json:"is_private_path,omitempty"`
// The listeners of this load balancer.
Listeners []LoadBalancerListenerPrototypeLoadBalancerContext `json:"listeners,omitempty"`
// 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. If unspecified, `datapath.active` will be `false`.
//
// To activate logging, the load balancer profile must support the specified logging type.
Logging *LoadBalancerLoggingPrototype `json:"logging,omitempty"`
// The name for this load balancer. The name must not be used by another load balancer in the VPC. If unspecified, the
// name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The pools of this load balancer.
Pools []LoadBalancerPoolPrototypeLoadBalancerContext `json:"pools,omitempty"`
// The profile to use for this load balancer.
//
// If unspecified, `application` will be used.
Profile LoadBalancerProfileIdentityIntf `json:"profile,omitempty"`
// The resource group to use. If unspecified, the account's [default resource
// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// Indicates whether [route mode](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-vnf&interface=ui) is enabled for this
// load balancer.
//
// At present, public load balancers are not supported with route mode enabled.
RouteMode *bool `json:"route_mode,omitempty"`
// The security groups to use for this load balancer. If unspecified, the VPC's default security group is used.
//
// The load balancer profile must support security groups.
SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"`
// 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
}
// SetDns : Allow user to set Dns
func (_options *CreateLoadBalancerOptions) SetDns(dns *LoadBalancerDnsPrototype) *CreateLoadBalancerOptions {
_options.Dns = dns
return _options
}
// SetIsPrivatePath : Allow user to set IsPrivatePath
func (_options *CreateLoadBalancerOptions) SetIsPrivatePath(isPrivatePath bool) *CreateLoadBalancerOptions {
_options.IsPrivatePath = core.BoolPtr(isPrivatePath)
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 *LoadBalancerLoggingPrototype) *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 []LoadBalancerPoolPrototypeLoadBalancerContext) *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
}
// SetRouteMode : Allow user to set RouteMode
func (_options *CreateLoadBalancerOptions) SetRouteMode(routeMode bool) *CreateLoadBalancerOptions {
_options.RouteMode = core.BoolPtr(routeMode)
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 `json:"load_balancer_id" validate:"required,ne="`
// The pool identifier.
PoolID *string `json:"pool_id" validate:"required,ne="`
// The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a
// listener with a single port. (If the traffic is received on a listener with a port range, the member will receive
// the traffic on the same port the listener received it on.)
//
// This port will also be used for health checks unless the `port` property of
// `health_monitor` property is specified.
//
// The port must be unique across all members for all pools associated with this pool's listener.
//
// 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.
Port *int64 `json:"port" validate:"required"`
// The pool member target.
//
// If the load balancer has `route_mode` set to `true`, the member must be in a zone the load
// balancer has a subnet in.
//
// 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.
Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"`
// The weight of the member.
//
// If specified, the pool algorithm must be `weighted_round_robin` and the load balancer must be in the `application`
// family.
//
// If unspecified, the weight will be `50` for load balancers in the `application` family.
Weight *int64 `json:"weight,omitempty"`
// 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 `json:"load_balancer_id" validate:"required,ne="`
// The load balancing algorithm. The `least_connections` algorithm is only supported for load balancers that have
// `availability` with value `subnet` in the profile.
Algorithm *string `json:"algorithm" validate:"required"`
// The health monitor of this pool.
//
// If this pool has a member targeting a load balancer then:
//
// - If the targeted load balancer has multiple subnets, this health monitor will be
// used to direct traffic to the available subnets.
// - The health checks spawned by this health monitor will be handled as any other
// traffic (that is, subject to the configuration of listeners and pools on the target
// load balancer).
// - This health monitor does not affect how pool member health is determined within the
// target load balancer.
//
// For more information, see [Private Path network load balancer frequently asked
// questions](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-faqs#ppnlb-faqs).
HealthMonitor LoadBalancerPoolHealthMonitorPrototypeIntf `json:"health_monitor" validate:"required"`
// The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if
// `udp_supported` is `true`). Load balancers in the
// `application` family support `tcp`, `http`, and `https`.
Protocol *string `json:"protocol" validate:"required"`
// The failsafe policy to use for this pool.
//
// If unspecified, the default failsafe policy action from the profile will be used.
FailsafePolicy *LoadBalancerPoolFailsafePolicyPrototype `json:"failsafe_policy,omitempty"`
// 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 name for this load balancer pool. The name must not be used by another pool for the load balancer. If
// unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,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
//
// For load balancers in the `network` family, this property must be `disabled`.
ProxyProtocol *string `json:"proxy_protocol,omitempty"`
// The session persistence of this pool. If specified, the load balancer must have
// `source_ip_session_persistence_supported` set to `true` in its profile.
//
// If unspecified, session persistence will be disabled, and traffic will be distributed
// across members of the pool.
SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the CreateLoadBalancerPoolOptions.Algorithm property.
// The load balancing algorithm. The `least_connections` algorithm is only supported for load balancers that have
// `availability` with value `subnet` in the profile.
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` and `udp` (if
// `udp_supported` is `true`). Load balancers in the
// `application` family support `tcp`, `http`, and `https`.
const (
CreateLoadBalancerPoolOptionsProtocolHTTPConst = "http"
CreateLoadBalancerPoolOptionsProtocolHTTPSConst = "https"
CreateLoadBalancerPoolOptionsProtocolTCPConst = "tcp"
CreateLoadBalancerPoolOptionsProtocolUDPConst = "udp"
)
// 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
//
// For load balancers in the `network` family, this property must be `disabled`.
const (
CreateLoadBalancerPoolOptionsProxyProtocolDisabledConst = "disabled"
CreateLoadBalancerPoolOptionsProxyProtocolV1Const = "v1"
CreateLoadBalancerPoolOptionsProxyProtocolV2Const = "v2"
)
// NewCreateLoadBalancerPoolOptions : Instantiate CreateLoadBalancerPoolOptions
func (*VpcV1) NewCreateLoadBalancerPoolOptions(loadBalancerID string, algorithm string, healthMonitor LoadBalancerPoolHealthMonitorPrototypeIntf, 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 LoadBalancerPoolHealthMonitorPrototypeIntf) *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
}
// SetFailsafePolicy : Allow user to set FailsafePolicy
func (_options *CreateLoadBalancerPoolOptions) SetFailsafePolicy(failsafePolicy *LoadBalancerPoolFailsafePolicyPrototype) *CreateLoadBalancerPoolOptions {
_options.FailsafePolicy = failsafePolicy
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 `json:"NetworkACLPrototype" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateNetworkACLOptions : Instantiate CreateNetworkACLOptions
func (*VpcV1) NewCreateNetworkACLOptions(networkACLPrototype NetworkACLPrototypeIntf) *CreateNetworkACLOptions {
return &CreateNetworkACLOptions{
NetworkACLPrototype: networkACLPrototype,
}
}
// 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 `json:"network_acl_id" validate:"required,ne="`
// The network ACL rule prototype object.
NetworkACLRulePrototype NetworkACLRulePrototypeIntf `json:"NetworkACLRulePrototype" 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
}
// CreatePlacementGroupOptions : The CreatePlacementGroup options.
type CreatePlacementGroupOptions struct {
// The strategy for this placement group:
// - `host_spread`: place on different compute hosts
// - `power_spread`: place on compute hosts that use different power sources.
Strategy *string `json:"strategy" validate:"required"`
// The name for this placement group. The name must not be used by another placement group in the region. 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the CreatePlacementGroupOptions.Strategy property.
// The strategy for this placement group:
// - `host_spread`: place on different compute hosts
// - `power_spread`: place on compute hosts that use different power sources.
const (
CreatePlacementGroupOptionsStrategyHostSpreadConst = "host_spread"
CreatePlacementGroupOptionsStrategyPowerSpreadConst = "power_spread"
)
// NewCreatePlacementGroupOptions : Instantiate CreatePlacementGroupOptions
func (*VpcV1) NewCreatePlacementGroupOptions(strategy string) *CreatePlacementGroupOptions {
return &CreatePlacementGroupOptions{
Strategy: core.StringPtr(strategy),
}
}
// SetStrategy : Allow user to set Strategy
func (_options *CreatePlacementGroupOptions) SetStrategy(strategy string) *CreatePlacementGroupOptions {
_options.Strategy = core.StringPtr(strategy)
return _options
}
// SetName : Allow user to set Name
func (_options *CreatePlacementGroupOptions) SetName(name string) *CreatePlacementGroupOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetResourceGroup : Allow user to set ResourceGroup
func (_options *CreatePlacementGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreatePlacementGroupOptions {
_options.ResourceGroup = resourceGroup
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreatePlacementGroupOptions) SetHeaders(param map[string]string) *CreatePlacementGroupOptions {
options.Headers = param
return options
}
// CreatePrivatePathServiceGatewayAccountPolicyOptions : The CreatePrivatePathServiceGatewayAccountPolicy options.
type CreatePrivatePathServiceGatewayAccountPolicyOptions struct {
// The private path service gateway identifier.
PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="`
// The access policy for the account. Updating the access policy only affects pending and future endpoint gateway
// bindings.
// - permit: access will be permitted
// - deny: access will be denied
// - review: access will be manually reviewed
//
// - Updating to `review` sets the status of future endpoint gateway bindings from
// this account to `pending`.
// - Updating to `permit` updates both the status of any `pending` and future endpoint
// gateway bindings from this account to `permitted`.
// - Updating to `deny` updates both the status of any `pending` and future endpoint
// gateway bindings from this account to `denied`.
AccessPolicy *string `json:"access_policy" validate:"required"`
// The account for this access policy. The account must be unique across all account
// policies for this private path service gateway.
Account AccountIdentityIntf `json:"account" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the CreatePrivatePathServiceGatewayAccountPolicyOptions.AccessPolicy property.
// The access policy for the account. Updating the access policy only affects pending and future endpoint gateway
// bindings.
// - permit: access will be permitted
// - deny: access will be denied
// - review: access will be manually reviewed
//
// - Updating to `review` sets the status of future endpoint gateway bindings from
// this account to `pending`.
// - Updating to `permit` updates both the status of any `pending` and future endpoint
// gateway bindings from this account to `permitted`.
// - Updating to `deny` updates both the status of any `pending` and future endpoint
// gateway bindings from this account to `denied`.
const (
CreatePrivatePathServiceGatewayAccountPolicyOptionsAccessPolicyDenyConst = "deny"
CreatePrivatePathServiceGatewayAccountPolicyOptionsAccessPolicyPermitConst = "permit"
CreatePrivatePathServiceGatewayAccountPolicyOptionsAccessPolicyReviewConst = "review"
)
// NewCreatePrivatePathServiceGatewayAccountPolicyOptions : Instantiate CreatePrivatePathServiceGatewayAccountPolicyOptions
func (*VpcV1) NewCreatePrivatePathServiceGatewayAccountPolicyOptions(privatePathServiceGatewayID string, accessPolicy string, account AccountIdentityIntf) *CreatePrivatePathServiceGatewayAccountPolicyOptions {
return &CreatePrivatePathServiceGatewayAccountPolicyOptions{
PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID),
AccessPolicy: core.StringPtr(accessPolicy),
Account: account,
}
}
// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID
func (_options *CreatePrivatePathServiceGatewayAccountPolicyOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *CreatePrivatePathServiceGatewayAccountPolicyOptions {
_options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID)
return _options
}
// SetAccessPolicy : Allow user to set AccessPolicy
func (_options *CreatePrivatePathServiceGatewayAccountPolicyOptions) SetAccessPolicy(accessPolicy string) *CreatePrivatePathServiceGatewayAccountPolicyOptions {
_options.AccessPolicy = core.StringPtr(accessPolicy)
return _options
}
// SetAccount : Allow user to set Account
func (_options *CreatePrivatePathServiceGatewayAccountPolicyOptions) SetAccount(account AccountIdentityIntf) *CreatePrivatePathServiceGatewayAccountPolicyOptions {
_options.Account = account
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreatePrivatePathServiceGatewayAccountPolicyOptions) SetHeaders(param map[string]string) *CreatePrivatePathServiceGatewayAccountPolicyOptions {
options.Headers = param
return options
}
// CreatePrivatePathServiceGatewayOptions : The CreatePrivatePathServiceGateway options.
type CreatePrivatePathServiceGatewayOptions struct {
// The load balancer for this private path service gateway. The load balancer must
// have `is_private_path` set to `true`.
//
// The private path service gateway will reside in the same VPC as the specified load
// balancer.
LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer" validate:"required"`
// The fully qualified domain names for this private path service gateway. Any uppercase letters will be converted to
// lowercase.
ServiceEndpoints []string `json:"service_endpoints" validate:"required"`
// The policy to use for bindings from accounts without an explicit account policy.
DefaultAccessPolicy *string `json:"default_access_policy,omitempty"`
// The name for this private path service gateway. The name must not be used by another private path service gateway in
// the VPC. 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// Indicates whether this private path service gateway has zonal affinity.
// - `true`: Traffic to the service from a zone the service resides in will remain in
// that zone.
// - `false`: Traffic to the service from a zone will be load balanced across all zones
// in the region the service resides in.
ZonalAffinity *bool `json:"zonal_affinity,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the CreatePrivatePathServiceGatewayOptions.DefaultAccessPolicy property.
// The policy to use for bindings from accounts without an explicit account policy.
const (
CreatePrivatePathServiceGatewayOptionsDefaultAccessPolicyDenyConst = "deny"
CreatePrivatePathServiceGatewayOptionsDefaultAccessPolicyPermitConst = "permit"
CreatePrivatePathServiceGatewayOptionsDefaultAccessPolicyReviewConst = "review"
)
// NewCreatePrivatePathServiceGatewayOptions : Instantiate CreatePrivatePathServiceGatewayOptions
func (*VpcV1) NewCreatePrivatePathServiceGatewayOptions(loadBalancer LoadBalancerIdentityIntf, serviceEndpoints []string) *CreatePrivatePathServiceGatewayOptions {
return &CreatePrivatePathServiceGatewayOptions{
LoadBalancer: loadBalancer,
ServiceEndpoints: serviceEndpoints,
}
}
// SetLoadBalancer : Allow user to set LoadBalancer
func (_options *CreatePrivatePathServiceGatewayOptions) SetLoadBalancer(loadBalancer LoadBalancerIdentityIntf) *CreatePrivatePathServiceGatewayOptions {
_options.LoadBalancer = loadBalancer
return _options
}
// SetServiceEndpoints : Allow user to set ServiceEndpoints
func (_options *CreatePrivatePathServiceGatewayOptions) SetServiceEndpoints(serviceEndpoints []string) *CreatePrivatePathServiceGatewayOptions {
_options.ServiceEndpoints = serviceEndpoints
return _options
}
// SetDefaultAccessPolicy : Allow user to set DefaultAccessPolicy
func (_options *CreatePrivatePathServiceGatewayOptions) SetDefaultAccessPolicy(defaultAccessPolicy string) *CreatePrivatePathServiceGatewayOptions {
_options.DefaultAccessPolicy = core.StringPtr(defaultAccessPolicy)
return _options
}
// SetName : Allow user to set Name
func (_options *CreatePrivatePathServiceGatewayOptions) SetName(name string) *CreatePrivatePathServiceGatewayOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetResourceGroup : Allow user to set ResourceGroup
func (_options *CreatePrivatePathServiceGatewayOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreatePrivatePathServiceGatewayOptions {
_options.ResourceGroup = resourceGroup
return _options
}
// SetZonalAffinity : Allow user to set ZonalAffinity
func (_options *CreatePrivatePathServiceGatewayOptions) SetZonalAffinity(zonalAffinity bool) *CreatePrivatePathServiceGatewayOptions {
_options.ZonalAffinity = core.BoolPtr(zonalAffinity)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreatePrivatePathServiceGatewayOptions) SetHeaders(param map[string]string) *CreatePrivatePathServiceGatewayOptions {
options.Headers = param
return options
}
// CreatePublicAddressRangeOptions : The CreatePublicAddressRange options.
type CreatePublicAddressRangeOptions struct {
// The total number of public IPv4 addresses required. Must be a power of 2.
Ipv4AddressCount *int64 `json:"ipv4_address_count" validate:"required"`
// The name for this public address range. The name must not be used by another public address range in the region. 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The target to bind this public address range to. If unspecified, the public address
// range will not be bound to a target at creation.
Target *PublicAddressRangeTargetPrototype `json:"target,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreatePublicAddressRangeOptions : Instantiate CreatePublicAddressRangeOptions
func (*VpcV1) NewCreatePublicAddressRangeOptions(ipv4AddressCount int64) *CreatePublicAddressRangeOptions {
return &CreatePublicAddressRangeOptions{
Ipv4AddressCount: core.Int64Ptr(ipv4AddressCount),
}
}
// SetIpv4AddressCount : Allow user to set Ipv4AddressCount
func (_options *CreatePublicAddressRangeOptions) SetIpv4AddressCount(ipv4AddressCount int64) *CreatePublicAddressRangeOptions {
_options.Ipv4AddressCount = core.Int64Ptr(ipv4AddressCount)
return _options
}
// SetName : Allow user to set Name
func (_options *CreatePublicAddressRangeOptions) SetName(name string) *CreatePublicAddressRangeOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetResourceGroup : Allow user to set ResourceGroup
func (_options *CreatePublicAddressRangeOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreatePublicAddressRangeOptions {
_options.ResourceGroup = resourceGroup
return _options
}
// SetTarget : Allow user to set Target
func (_options *CreatePublicAddressRangeOptions) SetTarget(target *PublicAddressRangeTargetPrototype) *CreatePublicAddressRangeOptions {
_options.Target = target
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreatePublicAddressRangeOptions) SetHeaders(param map[string]string) *CreatePublicAddressRangeOptions {
options.Headers = param
return options
}
// CreatePublicGatewayOptions : The CreatePublicGateway options.
type CreatePublicGatewayOptions struct {
// The VPC this public gateway will reside in.
VPC VPCIdentityIntf `json:"vpc" validate:"required"`
// The zone this public gateway will reside in.
Zone ZoneIdentityIntf `json:"zone" validate:"required"`
FloatingIP PublicGatewayFloatingIPPrototypeIntf `json:"floating_ip,omitempty"`
// The name for this public gateway. The name must not be used by another public gateway in the VPC. 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// 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
}
// CreateReservationOptions : The CreateReservation options.
type CreateReservationOptions struct {
// The capacity reservation configuration to use.
Capacity *ReservationCapacityPrototype `json:"capacity" validate:"required"`
// The committed use configuration to use for this reservation.
CommittedUse *ReservationCommittedUsePrototype `json:"committed_use" validate:"required"`
// The [instance profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) or
// [bare metal server
// profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile)
// to use for this reservation.
Profile *ReservationProfilePrototype `json:"profile" validate:"required"`
// The zone to use for this reservation.
Zone ZoneIdentityIntf `json:"zone" validate:"required"`
// The affinity policy to use for this reservation:
// - `automatic`: The reservation will be automatically selected
// - `restricted`: The reservation must be manually requested.
AffinityPolicy *string `json:"affinity_policy,omitempty"`
// The name for this reservation. The name must not be used by another reservation in the region. 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the CreateReservationOptions.AffinityPolicy property.
// The affinity policy to use for this reservation:
// - `automatic`: The reservation will be automatically selected
// - `restricted`: The reservation must be manually requested.
const (
CreateReservationOptionsAffinityPolicyAutomaticConst = "automatic"
CreateReservationOptionsAffinityPolicyRestrictedConst = "restricted"
)
// NewCreateReservationOptions : Instantiate CreateReservationOptions
func (*VpcV1) NewCreateReservationOptions(capacity *ReservationCapacityPrototype, committedUse *ReservationCommittedUsePrototype, profile *ReservationProfilePrototype, zone ZoneIdentityIntf) *CreateReservationOptions {
return &CreateReservationOptions{
Capacity: capacity,
CommittedUse: committedUse,
Profile: profile,
Zone: zone,
}
}
// SetCapacity : Allow user to set Capacity
func (_options *CreateReservationOptions) SetCapacity(capacity *ReservationCapacityPrototype) *CreateReservationOptions {
_options.Capacity = capacity
return _options
}
// SetCommittedUse : Allow user to set CommittedUse
func (_options *CreateReservationOptions) SetCommittedUse(committedUse *ReservationCommittedUsePrototype) *CreateReservationOptions {
_options.CommittedUse = committedUse
return _options
}
// SetProfile : Allow user to set Profile
func (_options *CreateReservationOptions) SetProfile(profile *ReservationProfilePrototype) *CreateReservationOptions {
_options.Profile = profile
return _options
}
// SetZone : Allow user to set Zone
func (_options *CreateReservationOptions) SetZone(zone ZoneIdentityIntf) *CreateReservationOptions {
_options.Zone = zone
return _options
}
// SetAffinityPolicy : Allow user to set AffinityPolicy
func (_options *CreateReservationOptions) SetAffinityPolicy(affinityPolicy string) *CreateReservationOptions {
_options.AffinityPolicy = core.StringPtr(affinityPolicy)
return _options
}
// SetName : Allow user to set Name
func (_options *CreateReservationOptions) SetName(name string) *CreateReservationOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetResourceGroup : Allow user to set ResourceGroup
func (_options *CreateReservationOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateReservationOptions {
_options.ResourceGroup = resourceGroup
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateReservationOptions) SetHeaders(param map[string]string) *CreateReservationOptions {
options.Headers = param
return options
}
// CreateSecurityGroupOptions : The CreateSecurityGroup options.
type CreateSecurityGroupOptions struct {
// The VPC this security group will reside in.
VPC VPCIdentityIntf `json:"vpc" validate:"required"`
// The name for this security group. The name must not be used by another security group for the VPC. 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The prototype objects for rules to be created for this security group. If unspecified, no rules will be created,
// resulting in no traffic being allowed.
Rules []SecurityGroupRulePrototypeIntf `json:"rules,omitempty"`
// 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 `json:"security_group_id" validate:"required,ne="`
// The properties of the security group rule to be created.
SecurityGroupRulePrototype SecurityGroupRulePrototypeIntf `json:"SecurityGroupRulePrototype" 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 `json:"security_group_id" validate:"required,ne="`
// The security group target identifier.
ID *string `json:"id" 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
}
// CreateShareMountTargetOptions : The CreateShareMountTarget options.
type CreateShareMountTargetOptions struct {
// The file share identifier.
ShareID *string `json:"share_id" validate:"required,ne="`
// The share mount target prototype object.
ShareMountTargetPrototype ShareMountTargetPrototypeIntf `json:"ShareMountTargetPrototype" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateShareMountTargetOptions : Instantiate CreateShareMountTargetOptions
func (*VpcV1) NewCreateShareMountTargetOptions(shareID string, shareMountTargetPrototype ShareMountTargetPrototypeIntf) *CreateShareMountTargetOptions {
return &CreateShareMountTargetOptions{
ShareID: core.StringPtr(shareID),
ShareMountTargetPrototype: shareMountTargetPrototype,
}
}
// SetShareID : Allow user to set ShareID
func (_options *CreateShareMountTargetOptions) SetShareID(shareID string) *CreateShareMountTargetOptions {
_options.ShareID = core.StringPtr(shareID)
return _options
}
// SetShareMountTargetPrototype : Allow user to set ShareMountTargetPrototype
func (_options *CreateShareMountTargetOptions) SetShareMountTargetPrototype(shareMountTargetPrototype ShareMountTargetPrototypeIntf) *CreateShareMountTargetOptions {
_options.ShareMountTargetPrototype = shareMountTargetPrototype
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateShareMountTargetOptions) SetHeaders(param map[string]string) *CreateShareMountTargetOptions {
options.Headers = param
return options
}
// CreateShareOptions : The CreateShare options.
type CreateShareOptions struct {
// The file share prototype object.
SharePrototype SharePrototypeIntf `json:"SharePrototype" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateShareOptions : Instantiate CreateShareOptions
func (*VpcV1) NewCreateShareOptions(sharePrototype SharePrototypeIntf) *CreateShareOptions {
return &CreateShareOptions{
SharePrototype: sharePrototype,
}
}
// SetSharePrototype : Allow user to set SharePrototype
func (_options *CreateShareOptions) SetSharePrototype(sharePrototype SharePrototypeIntf) *CreateShareOptions {
_options.SharePrototype = sharePrototype
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateShareOptions) SetHeaders(param map[string]string) *CreateShareOptions {
options.Headers = param
return options
}
// CreateShareSnapshotOptions : The CreateShareSnapshot options.
type CreateShareSnapshotOptions struct {
// The file share identifier.
ShareID *string `json:"share_id" validate:"required,ne="`
// The name for this share snapshot. The name must not be used by another snapshot for the file share. If unspecified,
// the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this share snapshot.
UserTags []string `json:"user_tags,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateShareSnapshotOptions : Instantiate CreateShareSnapshotOptions
func (*VpcV1) NewCreateShareSnapshotOptions(shareID string) *CreateShareSnapshotOptions {
return &CreateShareSnapshotOptions{
ShareID: core.StringPtr(shareID),
}
}
// SetShareID : Allow user to set ShareID
func (_options *CreateShareSnapshotOptions) SetShareID(shareID string) *CreateShareSnapshotOptions {
_options.ShareID = core.StringPtr(shareID)
return _options
}
// SetName : Allow user to set Name
func (_options *CreateShareSnapshotOptions) SetName(name string) *CreateShareSnapshotOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetUserTags : Allow user to set UserTags
func (_options *CreateShareSnapshotOptions) SetUserTags(userTags []string) *CreateShareSnapshotOptions {
_options.UserTags = userTags
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateShareSnapshotOptions) SetHeaders(param map[string]string) *CreateShareSnapshotOptions {
options.Headers = param
return options
}
// CreateSnapshotCloneOptions : The CreateSnapshotClone options.
type CreateSnapshotCloneOptions struct {
// The snapshot identifier.
ID *string `json:"id" validate:"required,ne="`
// The zone name.
ZoneName *string `json:"zone_name" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateSnapshotCloneOptions : Instantiate CreateSnapshotCloneOptions
func (*VpcV1) NewCreateSnapshotCloneOptions(id string, zoneName string) *CreateSnapshotCloneOptions {
return &CreateSnapshotCloneOptions{
ID: core.StringPtr(id),
ZoneName: core.StringPtr(zoneName),
}
}
// SetID : Allow user to set ID
func (_options *CreateSnapshotCloneOptions) SetID(id string) *CreateSnapshotCloneOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetZoneName : Allow user to set ZoneName
func (_options *CreateSnapshotCloneOptions) SetZoneName(zoneName string) *CreateSnapshotCloneOptions {
_options.ZoneName = core.StringPtr(zoneName)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateSnapshotCloneOptions) SetHeaders(param map[string]string) *CreateSnapshotCloneOptions {
options.Headers = param
return options
}
// CreateSnapshotConsistencyGroupOptions : The CreateSnapshotConsistencyGroup options.
type CreateSnapshotConsistencyGroupOptions struct {
// The snapshot consistency group prototype object.
SnapshotConsistencyGroupPrototype SnapshotConsistencyGroupPrototypeIntf `json:"SnapshotConsistencyGroupPrototype" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateSnapshotConsistencyGroupOptions : Instantiate CreateSnapshotConsistencyGroupOptions
func (*VpcV1) NewCreateSnapshotConsistencyGroupOptions(snapshotConsistencyGroupPrototype SnapshotConsistencyGroupPrototypeIntf) *CreateSnapshotConsistencyGroupOptions {
return &CreateSnapshotConsistencyGroupOptions{
SnapshotConsistencyGroupPrototype: snapshotConsistencyGroupPrototype,
}
}
// SetSnapshotConsistencyGroupPrototype : Allow user to set SnapshotConsistencyGroupPrototype
func (_options *CreateSnapshotConsistencyGroupOptions) SetSnapshotConsistencyGroupPrototype(snapshotConsistencyGroupPrototype SnapshotConsistencyGroupPrototypeIntf) *CreateSnapshotConsistencyGroupOptions {
_options.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototype
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateSnapshotConsistencyGroupOptions) SetHeaders(param map[string]string) *CreateSnapshotConsistencyGroupOptions {
options.Headers = param
return options
}
// CreateSnapshotOptions : The CreateSnapshot options.
type CreateSnapshotOptions struct {
// The snapshot prototype object.
SnapshotPrototype SnapshotPrototypeIntf `json:"SnapshotPrototype" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateSnapshotOptions : Instantiate CreateSnapshotOptions
func (*VpcV1) NewCreateSnapshotOptions(snapshotPrototype SnapshotPrototypeIntf) *CreateSnapshotOptions {
return &CreateSnapshotOptions{
SnapshotPrototype: snapshotPrototype,
}
}
// SetSnapshotPrototype : Allow user to set SnapshotPrototype
func (_options *CreateSnapshotOptions) SetSnapshotPrototype(snapshotPrototype SnapshotPrototypeIntf) *CreateSnapshotOptions {
_options.SnapshotPrototype = snapshotPrototype
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateSnapshotOptions) SetHeaders(param map[string]string) *CreateSnapshotOptions {
options.Headers = param
return options
}
// CreateSubnetOptions : The CreateSubnet options.
type CreateSubnetOptions struct {
// The subnet prototype object.
SubnetPrototype SubnetPrototypeIntf `json:"SubnetPrototype" 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 `json:"subnet_id" validate:"required,ne="`
// The IP address to reserve, which must not already be reserved on the subnet.
//
// If unspecified, an available address on the subnet will automatically be selected.
Address *string `json:"address,omitempty"`
// Indicates whether this reserved IP member will be automatically deleted when either
// `target` is deleted, or the reserved IP is unbound. Must be `false` if the reserved IP is unbound.
AutoDelete *bool `json:"auto_delete,omitempty"`
// The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with
// `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated
// list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The target to bind this reserved IP to. The target must be in the same VPC.
//
// The following targets are supported:
// - An endpoint gateway not already bound to a reserved IP in the subnet's zone.
// - A virtual network interface.
//
// If unspecified, the reserved IP will be created unbound.
Target ReservedIPTargetPrototypeIntf `json:"target,omitempty"`
// 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
}
// SetAddress : Allow user to set Address
func (_options *CreateSubnetReservedIPOptions) SetAddress(address string) *CreateSubnetReservedIPOptions {
_options.Address = core.StringPtr(address)
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
}
// CreateVirtualNetworkInterfaceOptions : The CreateVirtualNetworkInterface options.
type CreateVirtualNetworkInterfaceOptions 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"`
// Indicates whether this virtual network interface will be automatically deleted when
// `target` is deleted. Must be `false` if the virtual network interface is unbound.
AutoDelete *bool `json:"auto_delete,omitempty"`
// If `true`:
// - The VPC infrastructure performs any needed NAT operations.
// - `floating_ips` must not have more than one floating IP.
//
// If `false`:
// - Packets are passed unchanged to/from the virtual network interface,
// allowing the workload to perform any needed NAT operations.
// - `allow_ip_spoofing` must be `false`.
// - Can only be attached to a `target` with a `resource_type` of
// `bare_metal_server_network_attachment`.
EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"`
// The additional IP addresses to bind to the virtual network interface. Each item may be either a reserved IP
// identity, or a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be
// in the primary IP's subnet.
//
// If reserved IP identities are provided, the specified reserved IPs must be unbound.
//
// If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network
// interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet
// will be automatically selected and reserved.
Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"`
// The name for this virtual network interface. The name must not be used by another virtual network interface in the
// VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are
// reserved for provider-owned resources, and are not allowed.
Name *string `json:"name,omitempty"`
// The primary IP address to bind to the virtual network interface. May be either a
// reserved IP identity, or a reserved IP prototype object which will be used to create a
// new reserved IP.
//
// If a reserved IP identity is provided, the specified reserved IP must be unbound.
//
// If a reserved IP prototype object with an address is provided, the address must be
// available on the virtual network interface's subnet. If no address is specified,
// an available address on the subnet will be automatically selected and reserved.
PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"`
// The protocol state filtering mode to use for this virtual network interface. If
// `auto`, protocol state packet filtering is enabled or disabled based on the virtual network interface's `target`
// resource type:
//
// - `bare_metal_server_network_attachment`: disabled
// - `instance_network_attachment`: enabled
// - `share_mount_target`: enabled
//
// Protocol state filtering monitors each network connection flowing over this virtual network interface, and drops any
// packets that are invalid based on the current connection state and protocol. See [Protocol state filtering
// mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information.
ProtocolStateFilteringMode *string `json:"protocol_state_filtering_mode,omitempty"`
// The resource group to use. If unspecified, the account's [default resource
// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC
// for the subnet is used.
SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"`
// The associated subnet. Required if `primary_ip` does not specify a reserved IP
// identity.
Subnet SubnetIdentityIntf `json:"subnet,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the CreateVirtualNetworkInterfaceOptions.ProtocolStateFilteringMode property.
// The protocol state filtering mode to use for this virtual network interface. If
// `auto`, protocol state packet filtering is enabled or disabled based on the virtual network interface's `target`
// resource type:
//
// - `bare_metal_server_network_attachment`: disabled
// - `instance_network_attachment`: enabled
// - `share_mount_target`: enabled
//
// Protocol state filtering monitors each network connection flowing over this virtual network interface, and drops any
// packets that are invalid based on the current connection state and protocol. See [Protocol state filtering
// mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information.
const (
CreateVirtualNetworkInterfaceOptionsProtocolStateFilteringModeAutoConst = "auto"
CreateVirtualNetworkInterfaceOptionsProtocolStateFilteringModeDisabledConst = "disabled"
CreateVirtualNetworkInterfaceOptionsProtocolStateFilteringModeEnabledConst = "enabled"
)
// NewCreateVirtualNetworkInterfaceOptions : Instantiate CreateVirtualNetworkInterfaceOptions
func (*VpcV1) NewCreateVirtualNetworkInterfaceOptions() *CreateVirtualNetworkInterfaceOptions {
return &CreateVirtualNetworkInterfaceOptions{}
}
// SetAllowIPSpoofing : Allow user to set AllowIPSpoofing
func (_options *CreateVirtualNetworkInterfaceOptions) SetAllowIPSpoofing(allowIPSpoofing bool) *CreateVirtualNetworkInterfaceOptions {
_options.AllowIPSpoofing = core.BoolPtr(allowIPSpoofing)
return _options
}
// SetAutoDelete : Allow user to set AutoDelete
func (_options *CreateVirtualNetworkInterfaceOptions) SetAutoDelete(autoDelete bool) *CreateVirtualNetworkInterfaceOptions {
_options.AutoDelete = core.BoolPtr(autoDelete)
return _options
}
// SetEnableInfrastructureNat : Allow user to set EnableInfrastructureNat
func (_options *CreateVirtualNetworkInterfaceOptions) SetEnableInfrastructureNat(enableInfrastructureNat bool) *CreateVirtualNetworkInterfaceOptions {
_options.EnableInfrastructureNat = core.BoolPtr(enableInfrastructureNat)
return _options
}
// SetIps : Allow user to set Ips
func (_options *CreateVirtualNetworkInterfaceOptions) SetIps(ips []VirtualNetworkInterfaceIPPrototypeIntf) *CreateVirtualNetworkInterfaceOptions {
_options.Ips = ips
return _options
}
// SetName : Allow user to set Name
func (_options *CreateVirtualNetworkInterfaceOptions) SetName(name string) *CreateVirtualNetworkInterfaceOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetPrimaryIP : Allow user to set PrimaryIP
func (_options *CreateVirtualNetworkInterfaceOptions) SetPrimaryIP(primaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf) *CreateVirtualNetworkInterfaceOptions {
_options.PrimaryIP = primaryIP
return _options
}
// SetProtocolStateFilteringMode : Allow user to set ProtocolStateFilteringMode
func (_options *CreateVirtualNetworkInterfaceOptions) SetProtocolStateFilteringMode(protocolStateFilteringMode string) *CreateVirtualNetworkInterfaceOptions {
_options.ProtocolStateFilteringMode = core.StringPtr(protocolStateFilteringMode)
return _options
}
// SetResourceGroup : Allow user to set ResourceGroup
func (_options *CreateVirtualNetworkInterfaceOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVirtualNetworkInterfaceOptions {
_options.ResourceGroup = resourceGroup
return _options
}
// SetSecurityGroups : Allow user to set SecurityGroups
func (_options *CreateVirtualNetworkInterfaceOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateVirtualNetworkInterfaceOptions {
_options.SecurityGroups = securityGroups
return _options
}
// SetSubnet : Allow user to set Subnet
func (_options *CreateVirtualNetworkInterfaceOptions) SetSubnet(subnet SubnetIdentityIntf) *CreateVirtualNetworkInterfaceOptions {
_options.Subnet = subnet
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateVirtualNetworkInterfaceOptions {
options.Headers = param
return options
}
// CreateVolumeOptions : The CreateVolume options.
type CreateVolumeOptions struct {
// The volume prototype object.
VolumePrototype VolumePrototypeIntf `json:"VolumePrototype" 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 `json:"vpc_id" validate:"required,ne="`
// The IPv4 range of the address prefix, expressed in CIDR format. The range 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 `json:"cidr" validate:"required"`
// The zone this address prefix will reside in.
Zone ZoneIdentityIntf `json:"zone" validate:"required"`
// Indicates whether this will be the default address prefix for this zone in this VPC. If `true`, the VPC must not
// have a default address prefix for this zone.
IsDefault *bool `json:"is_default,omitempty"`
// The name for this address prefix. The name must not be used by another address prefix for the VPC. If unspecified,
// the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// 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
}
// CreateVPCDnsResolutionBindingOptions : The CreateVPCDnsResolutionBinding options.
type CreateVPCDnsResolutionBindingOptions struct {
// The VPC identifier.
VPCID *string `json:"vpc_id" validate:"required,ne="`
// The VPC to bind this VPC to for DNS resolution. The VPC must be different from the VPC
// specified in the URL, must have `dns.enable_hub` set to `true`, and may be in a
// different account (subject to IAM policies).
//
// Additionally, the VPC specified in the URL (this VPC) must have `dns.enable_hub` set
// to `false` and a `dns.resolution_binding_count` of zero.
VPC VPCIdentityIntf `json:"vpc" validate:"required"`
// The name for this DNS resolution binding. The name must not be used by another DNS resolution binding for the VPC.
// If unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewCreateVPCDnsResolutionBindingOptions : Instantiate CreateVPCDnsResolutionBindingOptions
func (*VpcV1) NewCreateVPCDnsResolutionBindingOptions(vpcID string, vpc VPCIdentityIntf) *CreateVPCDnsResolutionBindingOptions {
return &CreateVPCDnsResolutionBindingOptions{
VPCID: core.StringPtr(vpcID),
VPC: vpc,
}
}
// SetVPCID : Allow user to set VPCID
func (_options *CreateVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *CreateVPCDnsResolutionBindingOptions {
_options.VPCID = core.StringPtr(vpcID)
return _options
}
// SetVPC : Allow user to set VPC
func (_options *CreateVPCDnsResolutionBindingOptions) SetVPC(vpc VPCIdentityIntf) *CreateVPCDnsResolutionBindingOptions {
_options.VPC = vpc
return _options
}
// SetName : Allow user to set Name
func (_options *CreateVPCDnsResolutionBindingOptions) SetName(name string) *CreateVPCDnsResolutionBindingOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *CreateVPCDnsResolutionBindingOptions {
options.Headers = param
return options
}
// CreateVPCOptions : The CreateVPC options.
type CreateVPCOptions struct {
// Indicates whether a [default address prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-configuring-address-prefixes)
// will be automatically created for each zone in this VPC. If `manual`, this VPC will be created with no default
// address prefixes.
//
// Since address prefixes are managed identically regardless of whether they were automatically created, the value is
// not preserved as a VPC property.
AddressPrefixManagement *string `json:"address_prefix_management,omitempty"`
// Indicates whether this VPC will 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.
//
// This property has been deprecated. Instead, use a [Transit Gateway](https://cloud.ibm.com/docs/transit-gateway) to
// connect this VPC to Classic Infrastructure. For more information, see [upcoming
// changes](https://cloud.ibm.com/docs/vpc?topic=vpc-api-change-log#upcoming-changes).
// Deprecated: this field is deprecated and may be removed in a future release.
ClassicAccess *bool `json:"classic_access,omitempty"`
// The DNS configuration for this VPC.
//
// If unspecified, the system will assign DNS servers capable of resolving hosts and endpoint
// gateways within this VPC, and hosts on the internet.
Dns *VpcdnsPrototype `json:"dns,omitempty"`
// The name for this VPC. The name must not be used by another VPC in the region. 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// 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](https://cloud.ibm.com/docs/vpc?topic=vpc-configuring-address-prefixes)
// will be automatically created for each zone in this VPC. If `manual`, this VPC will be created with no default
// address prefixes.
//
// Since address prefixes are managed identically regardless of whether they were automatically created, the value is
// not preserved as a VPC property.
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
// Deprecated: this method is deprecated and may be removed in a future release.
func (_options *CreateVPCOptions) SetClassicAccess(classicAccess bool) *CreateVPCOptions {
_options.ClassicAccess = core.BoolPtr(classicAccess)
return _options
}
// SetDns : Allow user to set Dns
func (_options *CreateVPCOptions) SetDns(dns *VpcdnsPrototype) *CreateVPCOptions {
_options.Dns = dns
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 `json:"vpc_id" validate:"required,ne="`
// The destination CIDR of the route. The host identifier in the CIDR must be zero.
//
// At most two routes per `zone` in a table can have the same `destination` and
// `priority`, 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 zone to apply the route to.
//
// If subnets are attached to the route's routing table, egress traffic from those
// subnets in this zone will be subject to this route. If this route's routing table
// has any of `route_direct_link_ingress`, `route_internet_ingress`,
// `route_transit_gateway_ingress` or `route_vpc_zone_ingress` set to`true`, traffic
// from those ingress sources arriving in this zone will be subject to this route.
Zone ZoneIdentityIntf `json:"zone" validate:"required"`
// The action to perform with a packet matching the route:
// - `delegate`: delegate to system-provided routes
// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes
// - `deliver`: deliver the packet to the specified `next_hop`
// - `drop`: drop the packet.
Action *string `json:"action,omitempty"`
// Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to`
// routing table property.
//
// All routes in a routing table with the same `destination` and `zone` must have the same
// `advertise` value.
Advertise *bool `json:"advertise,omitempty"`
// The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-`
// are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of
// randomly-selected words.
Name *string `json:"name,omitempty"`
// If `action` is `deliver`, the next hop that packets will be delivered to (must not be
// `0.0.0.0`). For other `action` values, it must be omitted or specified as `0.0.0.0`.
//
// At most two routes per `zone` in a table can have the same `destination` and `priority`,
// and only when each route has an `action` of `deliver` and `next_hop` is an IP address.
NextHop RouteNextHopPrototypeIntf `json:"next_hop,omitempty"`
// The priority of this route. Smaller values have higher priority.
//
// If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest
// priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is
// distributed between them.
Priority *int64 `json:"priority,omitempty"`
// 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 system-provided routes
// - `delegate_vpc`: delegate to system-provided 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
}
// SetAdvertise : Allow user to set Advertise
func (_options *CreateVPCRouteOptions) SetAdvertise(advertise bool) *CreateVPCRouteOptions {
_options.Advertise = core.BoolPtr(advertise)
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
}
// SetPriority : Allow user to set Priority
func (_options *CreateVPCRouteOptions) SetPriority(priority int64) *CreateVPCRouteOptions {
_options.Priority = core.Int64Ptr(priority)
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 `json:"vpc_id" validate:"required,ne="`
// The filters specifying the resources that may create routes in this routing table.
//
// If specified, `resource_type` must be `vpn_gateway` or `vpn_server`.
AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"`
// The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these
// sources.
AdvertiseRoutesTo []string `json:"advertise_routes_to,omitempty"`
// The name for this routing table. The name must not be used by another routing table in the VPC. If unspecified, the
// name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// 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. 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 in a subnet in the route's `zone` that is
// able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of 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.
RouteDirectLinkIngress *bool `json:"route_direct_link_ingress,omitempty"`
// If set to `true`, this routing table will be used to route traffic that originates from the internet. 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 two exceptions:
// - Traffic destined for IP addresses associated with public gateways will not be
// subject to routes in this routing table.
// - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is
// an IP address in a subnet in the route's `zone` that is able to accept traffic.
// Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway
// connection, the packet will be dropped.
RouteInternetIngress *bool `json:"route_internet_ingress,omitempty"`
// If set to `true`, this routing table will be used to route traffic that originates from [Transit
// Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. 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 in a subnet in the route's `zone` that is
// able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway
// connection, the packet will be dropped.
RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress,omitempty"`
// If set to `true`, this routing table will be used to route traffic that originates from subnets in other zones in
// this VPC. 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 in a subnet in the route's `zone` that is
// able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway
// connection, the packet will be dropped.
RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"`
// The prototype objects for routes to create for this routing table. If unspecified, the routing table will be created
// with no routes.
Routes []RoutePrototype `json:"routes,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the CreateVPCRoutingTableOptions.AdvertiseRoutesTo property.
// An ingress source that routes can be advertised to:
//
// - `direct_link` (requires `route_direct_link_ingress` be set to `true`)
// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`).
const (
CreateVPCRoutingTableOptionsAdvertiseRoutesToDirectLinkConst = "direct_link"
CreateVPCRoutingTableOptionsAdvertiseRoutesToTransitGatewayConst = "transit_gateway"
)
// 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
}
// SetAcceptRoutesFrom : Allow user to set AcceptRoutesFrom
func (_options *CreateVPCRoutingTableOptions) SetAcceptRoutesFrom(acceptRoutesFrom []ResourceFilter) *CreateVPCRoutingTableOptions {
_options.AcceptRoutesFrom = acceptRoutesFrom
return _options
}
// SetAdvertiseRoutesTo : Allow user to set AdvertiseRoutesTo
func (_options *CreateVPCRoutingTableOptions) SetAdvertiseRoutesTo(advertiseRoutesTo []string) *CreateVPCRoutingTableOptions {
_options.AdvertiseRoutesTo = advertiseRoutesTo
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
}
// SetRouteInternetIngress : Allow user to set RouteInternetIngress
func (_options *CreateVPCRoutingTableOptions) SetRouteInternetIngress(routeInternetIngress bool) *CreateVPCRoutingTableOptions {
_options.RouteInternetIngress = core.BoolPtr(routeInternetIngress)
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 `json:"vpc_id" validate:"required,ne="`
// The routing table identifier.
RoutingTableID *string `json:"routing_table_id" validate:"required,ne="`
// The destination CIDR of the route. The host identifier in the CIDR must be zero.
//
// At most two routes per `zone` in a table can have the same `destination` and
// `priority`, 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 zone to apply the route to.
//
// If subnets are attached to the route's routing table, egress traffic from those
// subnets in this zone will be subject to this route. If this route's routing table
// has any of `route_direct_link_ingress`, `route_internet_ingress`,
// `route_transit_gateway_ingress` or `route_vpc_zone_ingress` set to`true`, traffic
// from those ingress sources arriving in this zone will be subject to this route.
Zone ZoneIdentityIntf `json:"zone" validate:"required"`
// The action to perform with a packet matching the route:
// - `delegate`: delegate to system-provided routes
// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes
// - `deliver`: deliver the packet to the specified `next_hop`
// - `drop`: drop the packet.
Action *string `json:"action,omitempty"`
// Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to`
// routing table property.
//
// All routes in a routing table with the same `destination` and `zone` must have the same
// `advertise` value.
Advertise *bool `json:"advertise,omitempty"`
// The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-`
// are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of
// randomly-selected words.
Name *string `json:"name,omitempty"`
// If `action` is `deliver`, the next hop that packets will be delivered to (must not be
// `0.0.0.0`). For other `action` values, it must be omitted or specified as `0.0.0.0`.
//
// At most two routes per `zone` in a table can have the same `destination` and `priority`,
// and only when each route has an `action` of `deliver` and `next_hop` is an IP address.
NextHop RouteNextHopPrototypeIntf `json:"next_hop,omitempty"`
// The priority of this route. Smaller values have higher priority.
//
// If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest
// priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is
// distributed between them.
Priority *int64 `json:"priority,omitempty"`
// 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 system-provided routes
// - `delegate_vpc`: delegate to system-provided 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
}
// SetAdvertise : Allow user to set Advertise
func (_options *CreateVPCRoutingTableRouteOptions) SetAdvertise(advertise bool) *CreateVPCRoutingTableRouteOptions {
_options.Advertise = core.BoolPtr(advertise)
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
}
// SetPriority : Allow user to set Priority
func (_options *CreateVPCRoutingTableRouteOptions) SetPriority(priority int64) *CreateVPCRoutingTableRouteOptions {
_options.Priority = core.Int64Ptr(priority)
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 `json:"vpn_gateway_id" validate:"required,ne="`
// The VPN gateway connection prototype object.
VPNGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf `json:"VPNGatewayConnectionPrototype" 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 `json:"VPNGatewayPrototype" 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
}
// CreateVPNServerOptions : The CreateVPNServer options.
type CreateVPNServerOptions struct {
// The certificate instance for this VPN server.
Certificate CertificateInstanceIdentityIntf `json:"certificate" validate:"required"`
// The methods used to authenticate VPN clients to this VPN server. VPN clients must authenticate against all specified
// methods.
ClientAuthentication []VPNServerAuthenticationPrototypeIntf `json:"client_authentication" validate:"required"`
// The VPN client IPv4 address pool, 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 client IP address pool's CIDR must be between
// `/9` (8,388,608 addresses) and `/22` (1024 addresses). A CIDR block that contains twice the number of IP addresses
// that are required to enable the maximum number of concurrent connections is recommended.
ClientIPPool *string `json:"client_ip_pool" validate:"required"`
// The subnets to provision this VPN server in. Use subnets in different zones for high availability.
Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"`
// The DNS server addresses that will be provided to VPN clients connected to this VPN server.
ClientDnsServerIps []IP `json:"client_dns_server_ips,omitempty"`
// The seconds a VPN client can be idle before this VPN server will disconnect it. Specify `0` to prevent the server
// from disconnecting idle clients.
ClientIdleTimeout *int64 `json:"client_idle_timeout,omitempty"`
// Indicates whether the split tunneling is enabled on this VPN server.
EnableSplitTunneling *bool `json:"enable_split_tunneling,omitempty"`
// The name for this VPN server. The name must not be used by another VPN server in the VPC. If unspecified, the name
// will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The port number to use for this VPN server.
Port *int64 `json:"port,omitempty"`
// The transport protocol to use for this VPN server.
Protocol *string `json:"protocol,omitempty"`
// The resource group to use. If unspecified, the account's [default resource
// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The security groups to use for this VPN server. If unspecified, the VPC's default security group is used.
SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the CreateVPNServerOptions.Protocol property.
// The transport protocol to use for this VPN server.
const (
CreateVPNServerOptionsProtocolTCPConst = "tcp"
CreateVPNServerOptionsProtocolUDPConst = "udp"
)
// NewCreateVPNServerOptions : Instantiate CreateVPNServerOptions
func (*VpcV1) NewCreateVPNServerOptions(certificate CertificateInstanceIdentityIntf, clientAuthentication []VPNServerAuthenticationPrototypeIntf, clientIPPool string, subnets []SubnetIdentityIntf) *CreateVPNServerOptions {
return &CreateVPNServerOptions{
Certificate: certificate,
ClientAuthentication: clientAuthentication,
ClientIPPool: core.StringPtr(clientIPPool),
Subnets: subnets,
}
}
// SetCertificate : Allow user to set Certificate
func (_options *CreateVPNServerOptions) SetCertificate(certificate CertificateInstanceIdentityIntf) *CreateVPNServerOptions {
_options.Certificate = certificate
return _options
}
// SetClientAuthentication : Allow user to set ClientAuthentication
func (_options *CreateVPNServerOptions) SetClientAuthentication(clientAuthentication []VPNServerAuthenticationPrototypeIntf) *CreateVPNServerOptions {
_options.ClientAuthentication = clientAuthentication
return _options
}
// SetClientIPPool : Allow user to set ClientIPPool
func (_options *CreateVPNServerOptions) SetClientIPPool(clientIPPool string) *CreateVPNServerOptions {
_options.ClientIPPool = core.StringPtr(clientIPPool)
return _options
}
// SetSubnets : Allow user to set Subnets
func (_options *CreateVPNServerOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateVPNServerOptions {
_options.Subnets = subnets
return _options
}
// SetClientDnsServerIps : Allow user to set ClientDnsServerIps
func (_options *CreateVPNServerOptions) SetClientDnsServerIps(clientDnsServerIps []IP) *CreateVPNServerOptions {
_options.ClientDnsServerIps = clientDnsServerIps
return _options
}
// SetClientIdleTimeout : Allow user to set ClientIdleTimeout
func (_options *CreateVPNServerOptions) SetClientIdleTimeout(clientIdleTimeout int64) *CreateVPNServerOptions {
_options.ClientIdleTimeout = core.Int64Ptr(clientIdleTimeout)
return _options
}
// SetEnableSplitTunneling : Allow user to set EnableSplitTunneling
func (_options *CreateVPNServerOptions) SetEnableSplitTunneling(enableSplitTunneling bool) *CreateVPNServerOptions {
_options.EnableSplitTunneling = core.BoolPtr(enableSplitTunneling)
return _options
}
// SetName : Allow user to set Name
func (_options *CreateVPNServerOptions) SetName(name string) *CreateVPNServerOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetPort : Allow user to set Port
func (_options *CreateVPNServerOptions) SetPort(port int64) *CreateVPNServerOptions {
_options.Port = core.Int64Ptr(port)
return _options
}
// SetProtocol : Allow user to set Protocol
func (_options *CreateVPNServerOptions) SetProtocol(protocol string) *CreateVPNServerOptions {
_options.Protocol = core.StringPtr(protocol)
return _options
}
// SetResourceGroup : Allow user to set ResourceGroup
func (_options *CreateVPNServerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVPNServerOptions {
_options.ResourceGroup = resourceGroup
return _options
}
// SetSecurityGroups : Allow user to set SecurityGroups
func (_options *CreateVPNServerOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateVPNServerOptions {
_options.SecurityGroups = securityGroups
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateVPNServerOptions) SetHeaders(param map[string]string) *CreateVPNServerOptions {
options.Headers = param
return options
}
// CreateVPNServerRouteOptions : The CreateVPNServerRoute options.
type CreateVPNServerRouteOptions struct {
// The VPN server identifier.
VPNServerID *string `json:"vpn_server_id" validate:"required,ne="`
// The destination to use for this VPN route in the VPN server. Must be unique within the VPN server. If an incoming
// packet does not match any destination, it will be dropped.
Destination *string `json:"destination" validate:"required"`
// The action to perform with a packet matching the VPN route:
// - `translate`: translate the source IP address to one of the private IP addresses of
// the VPN server, then deliver the packet to target.
// - `deliver`: deliver the packet to the target.
// - `drop`: drop the packet.
Action *string `json:"action,omitempty"`
// The name for this VPN server route. The name must not be used by another route for the VPN server. If unspecified,
// the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the CreateVPNServerRouteOptions.Action property.
// The action to perform with a packet matching the VPN route:
// - `translate`: translate the source IP address to one of the private IP addresses of
// the VPN server, then deliver the packet to target.
// - `deliver`: deliver the packet to the target.
// - `drop`: drop the packet.
const (
CreateVPNServerRouteOptionsActionDeliverConst = "deliver"
CreateVPNServerRouteOptionsActionDropConst = "drop"
CreateVPNServerRouteOptionsActionTranslateConst = "translate"
)
// NewCreateVPNServerRouteOptions : Instantiate CreateVPNServerRouteOptions
func (*VpcV1) NewCreateVPNServerRouteOptions(vpnServerID string, destination string) *CreateVPNServerRouteOptions {
return &CreateVPNServerRouteOptions{
VPNServerID: core.StringPtr(vpnServerID),
Destination: core.StringPtr(destination),
}
}
// SetVPNServerID : Allow user to set VPNServerID
func (_options *CreateVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *CreateVPNServerRouteOptions {
_options.VPNServerID = core.StringPtr(vpnServerID)
return _options
}
// SetDestination : Allow user to set Destination
func (_options *CreateVPNServerRouteOptions) SetDestination(destination string) *CreateVPNServerRouteOptions {
_options.Destination = core.StringPtr(destination)
return _options
}
// SetAction : Allow user to set Action
func (_options *CreateVPNServerRouteOptions) SetAction(action string) *CreateVPNServerRouteOptions {
_options.Action = core.StringPtr(action)
return _options
}
// SetName : Allow user to set Name
func (_options *CreateVPNServerRouteOptions) SetName(name string) *CreateVPNServerRouteOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *CreateVPNServerRouteOptions) SetHeaders(param map[string]string) *CreateVPNServerRouteOptions {
options.Headers = param
return options
}
// DnsInstanceIdentity : Identifies a DNS instance by a unique property.
// Models which "extend" this model:
// - DnsInstanceIdentityByCRN
type DnsInstanceIdentity struct {
// The CRN for this DNS instance.
CRN *string `json:"crn,omitempty"`
}
func (*DnsInstanceIdentity) isaDnsInstanceIdentity() bool {
return true
}
type DnsInstanceIdentityIntf interface {
isaDnsInstanceIdentity() bool
asPatch() map[string]interface{}
}
// UnmarshalDnsInstanceIdentity unmarshals an instance of DnsInstanceIdentity from the specified map of raw messages.
func UnmarshalDnsInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(DnsInstanceIdentity)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the DnsInstanceIdentity
func (dnsInstanceIdentity *DnsInstanceIdentity) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(dnsInstanceIdentity.CRN) {
_patch["crn"] = dnsInstanceIdentity.CRN
}
return
}
// DnsInstanceReferenceLoadBalancerDnsContext : DnsInstanceReferenceLoadBalancerDnsContext struct
type DnsInstanceReferenceLoadBalancerDnsContext struct {
// The CRN for this DNS instance.
CRN *string `json:"crn" validate:"required"`
}
// UnmarshalDnsInstanceReferenceLoadBalancerDnsContext unmarshals an instance of DnsInstanceReferenceLoadBalancerDnsContext from the specified map of raw messages.
func UnmarshalDnsInstanceReferenceLoadBalancerDnsContext(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(DnsInstanceReferenceLoadBalancerDnsContext)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// DnsServer : A DNS server.
type DnsServer struct {
// The IP address.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in
// the future.
Address *string `json:"address" validate:"required"`
// If present, DHCP configuration for this zone will have this DNS server listed first.
ZoneAffinity *ZoneReference `json:"zone_affinity,omitempty"`
}
// UnmarshalDnsServer unmarshals an instance of DnsServer from the specified map of raw messages.
func UnmarshalDnsServer(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(DnsServer)
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone_affinity", &obj.ZoneAffinity, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone_affinity-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// DnsServerPrototype : DnsServerPrototype struct
type DnsServerPrototype struct {
// The DNS server IPv4 address.
Address *string `json:"address,omitempty"`
// If specified, DHCP configuration for the specified zone will have this DNS server listed
// first.
ZoneAffinity ZoneIdentityIntf `json:"zone_affinity,omitempty"`
}
// UnmarshalDnsServerPrototype unmarshals an instance of DnsServerPrototype from the specified map of raw messages.
func UnmarshalDnsServerPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(DnsServerPrototype)
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone_affinity", &obj.ZoneAffinity, UnmarshalZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zone_affinity-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the DnsServerPrototype
func (dnsServerPrototype *DnsServerPrototype) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(dnsServerPrototype.Address) {
_patch["address"] = dnsServerPrototype.Address
}
if !core.IsNil(dnsServerPrototype.ZoneAffinity) {
_patch["zone_affinity"] = dnsServerPrototype.ZoneAffinity.asPatch()
}
return
}
// DnsZoneIdentity : Identifies a DNS zone by a unique property.
// Models which "extend" this model:
// - DnsZoneIdentityByID
type DnsZoneIdentity struct {
ID *string `json:"id,omitempty"`
}
func (*DnsZoneIdentity) isaDnsZoneIdentity() bool {
return true
}
type DnsZoneIdentityIntf interface {
isaDnsZoneIdentity() bool
asPatch() map[string]interface{}
}
// UnmarshalDnsZoneIdentity unmarshals an instance of DnsZoneIdentity from the specified map of raw messages.
func UnmarshalDnsZoneIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(DnsZoneIdentity)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the DnsZoneIdentity
func (dnsZoneIdentity *DnsZoneIdentity) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(dnsZoneIdentity.ID) {
_patch["id"] = dnsZoneIdentity.ID
}
return
}
// DnsZoneReference : DnsZoneReference struct
type DnsZoneReference struct {
ID *string `json:"id" validate:"required"`
}
// UnmarshalDnsZoneReference unmarshals an instance of DnsZoneReference from the specified map of raw messages.
func UnmarshalDnsZoneReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(DnsZoneReference)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// 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"`
// The disks for the dedicated host.
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"`
// The instances that are allocated to this dedicated host.
Instances []InstanceReference `json:"instances" validate:"required"`
// The lifecycle state of the dedicated host.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The total amount of memory in gibibytes for this host.
Memory *int64 `json:"memory" validate:"required"`
// The name for this dedicated host. The name is unique across all dedicated hosts in the region.
Name *string `json:"name" validate:"required"`
// The dedicated host NUMA configuration.
Numa *DedicatedHostNuma `json:"numa" validate:"required"`
// The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) for this
// dedicated host.
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 resource type.
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 may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
State *string `json:"state" validate:"required"`
// The instance profiles usable 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.
const (
DedicatedHostLifecycleStateDeletingConst = "deleting"
DedicatedHostLifecycleStateFailedConst = "failed"
DedicatedHostLifecycleStatePendingConst = "pending"
DedicatedHostLifecycleStateStableConst = "stable"
DedicatedHostLifecycleStateSuspendedConst = "suspended"
DedicatedHostLifecycleStateUpdatingConst = "updating"
DedicatedHostLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the DedicatedHost.ResourceType property.
// The resource type.
const (
DedicatedHostResourceTypeDedicatedHostConst = "dedicated_host"
)
// Constants associated with the DedicatedHost.State property.
// The administrative state of the dedicated host.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 {
err = core.SDKErrorf(err, "", "available_memory-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "available_vcpu", &obj.AvailableVcpu, UnmarshalVcpu)
if err != nil {
err = core.SDKErrorf(err, "", "available_vcpu-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostDisk)
if err != nil {
err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled)
if err != nil {
err = core.SDKErrorf(err, "", "instance_placement_enabled-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "instances", &obj.Instances, UnmarshalInstanceReference)
if err != nil {
err = core.SDKErrorf(err, "", "instances-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "memory", &obj.Memory)
if err != nil {
err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "numa", &obj.Numa, UnmarshalDedicatedHostNuma)
if err != nil {
err = core.SDKErrorf(err, "", "numa-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileReference)
if err != nil {
err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable)
if err != nil {
err = core.SDKErrorf(err, "", "provisionable-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount)
if err != nil {
err = core.SDKErrorf(err, "", "socket_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "state", &obj.State)
if err != nil {
err = core.SDKErrorf(err, "", "state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference)
if err != nil {
err = core.SDKErrorf(err, "", "supported_instance_profiles-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalVcpu)
if err != nil {
err = core.SDKErrorf(err, "", "vcpu-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// DedicatedHostCollection : DedicatedHostCollection struct
type DedicatedHostCollection struct {
// A page of dedicated hosts.
DedicatedHosts []DedicatedHost `json:"dedicated_hosts" validate:"required"`
// A link to the first page of resources.
First *PageLink `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 *PageLink `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 {
err = core.SDKErrorf(err, "", "dedicated_hosts-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *DedicatedHostCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// 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"`
// The instance disks that are on this dedicated host disk.
InstanceDisks []InstanceDiskReference `json:"instance_disks" validate:"required"`
// The disk interface used for attaching the disk.
InterfaceType *string `json:"interface_type" validate:"required"`
// The lifecycle state of this dedicated host disk.
LifecycleState *string `json:"lifecycle_state,omitempty"`
// The name for this dedicated host disk. The name is unique across all disks on the dedicated host.
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 resource type.
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.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
SupportedInstanceInterfaceTypes []string `json:"supported_instance_interface_types" validate:"required"`
}
// Constants associated with the DedicatedHostDisk.InterfaceType property.
// The disk interface used for attaching the disk.
const (
DedicatedHostDiskInterfaceTypeNvmeConst = "nvme"
)
// Constants associated with the DedicatedHostDisk.LifecycleState property.
// The lifecycle state of this dedicated host disk.
const (
DedicatedHostDiskLifecycleStateDeletingConst = "deleting"
DedicatedHostDiskLifecycleStateFailedConst = "failed"
DedicatedHostDiskLifecycleStatePendingConst = "pending"
DedicatedHostDiskLifecycleStateStableConst = "stable"
DedicatedHostDiskLifecycleStateSuspendedConst = "suspended"
DedicatedHostDiskLifecycleStateUpdatingConst = "updating"
DedicatedHostDiskLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the DedicatedHostDisk.ResourceType property.
// The resource type.
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 may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 {
err = core.SDKErrorf(err, "", "available-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "instance_disks", &obj.InstanceDisks, UnmarshalInstanceDiskReference)
if err != nil {
err = core.SDKErrorf(err, "", "instance_disks-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType)
if err != nil {
err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable)
if err != nil {
err = core.SDKErrorf(err, "", "provisionable-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "size", &obj.Size)
if err != nil {
err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes)
if err != nil {
err = core.SDKErrorf(err, "", "supported_instance_interface_types-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// DedicatedHostDiskCollection : DedicatedHostDiskCollection struct
type DedicatedHostDiskCollection struct {
// The disks for the dedicated host.
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 {
err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// DedicatedHostDiskPatch : DedicatedHostDiskPatch struct
type DedicatedHostDiskPatch struct {
// The name for this dedicated host disk. The name must not be used by another disk on the dedicated host.
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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(dedicatedHostDiskPatch.Name) {
_patch["name"] = dedicatedHostDiskPatch.Name
}
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 name for this dedicated host group. The name is unique across all dedicated host groups in the region.
Name *string `json:"name" validate:"required"`
// The resource group for this dedicated host group.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The instance profiles usable 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 resource type.
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 {
err = core.SDKErrorf(err, "", "class-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "dedicated_hosts", &obj.DedicatedHosts, UnmarshalDedicatedHostReference)
if err != nil {
err = core.SDKErrorf(err, "", "dedicated_hosts-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "family", &obj.Family)
if err != nil {
err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference)
if err != nil {
err = core.SDKErrorf(err, "", "supported_instance_profiles-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
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 *PageLink `json:"first" validate:"required"`
// A page 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 *PageLink `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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "groups", &obj.Groups, UnmarshalDedicatedHostGroup)
if err != nil {
err = core.SDKErrorf(err, "", "groups-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *DedicatedHostGroupCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// 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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// DedicatedHostGroupPatch : DedicatedHostGroupPatch struct
type DedicatedHostGroupPatch struct {
// The name for this dedicated host group. The name must not be used by another dedicated host group in the region.
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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(dedicatedHostGroupPatch.Name) {
_patch["name"] = dedicatedHostGroupPatch.Name
}
return
}
// DedicatedHostGroupPrototypeDedicatedHostByZoneContext : DedicatedHostGroupPrototypeDedicatedHostByZoneContext struct
type DedicatedHostGroupPrototypeDedicatedHostByZoneContext struct {
// The name for this dedicated host group. The name must not be used by another dedicated host group in the region. 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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
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 *Deleted `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 name for this dedicated host group. The name is unique across all dedicated host groups in the region.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the DedicatedHostGroupReference.ResourceType property.
// The resource type.
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 {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// DedicatedHostNuma : The dedicated host NUMA configuration.
type DedicatedHostNuma struct {
// The total number of NUMA nodes for this dedicated host.
Count *int64 `json:"count" validate:"required"`
// The NUMA nodes for this dedicated host.
Nodes []DedicatedHostNumaNode `json:"nodes" validate:"required"`
}
// UnmarshalDedicatedHostNuma unmarshals an instance of DedicatedHostNuma from the specified map of raw messages.
func UnmarshalDedicatedHostNuma(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(DedicatedHostNuma)
err = core.UnmarshalPrimitive(m, "count", &obj.Count)
if err != nil {
err = core.SDKErrorf(err, "", "count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "nodes", &obj.Nodes, UnmarshalDedicatedHostNumaNode)
if err != nil {
err = core.SDKErrorf(err, "", "nodes-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// DedicatedHostNumaNode : The dedicated host NUMA node configuration.
type DedicatedHostNumaNode struct {
// The available VCPU for this NUMA node.
AvailableVcpu *int64 `json:"available_vcpu" validate:"required"`
// The total VCPU capacity for this NUMA node.
Vcpu *int64 `json:"vcpu" validate:"required"`
}
// UnmarshalDedicatedHostNumaNode unmarshals an instance of DedicatedHostNumaNode from the specified map of raw messages.
func UnmarshalDedicatedHostNumaNode(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(DedicatedHostNumaNode)
err = core.UnmarshalPrimitive(m, "available_vcpu", &obj.AvailableVcpu)
if err != nil {
err = core.SDKErrorf(err, "", "available_vcpu-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "vcpu", &obj.Vcpu)
if err != nil {
err = core.SDKErrorf(err, "", "vcpu-error", common.GetComponentInfo())
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 name for this dedicated host. The name must not be used by another dedicated host in the region.
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 {
err = core.SDKErrorf(err, "", "instance_placement_enabled-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(dedicatedHostPatch.InstancePlacementEnabled) {
_patch["instance_placement_enabled"] = dedicatedHostPatch.InstancePlacementEnabled
}
if !core.IsNil(dedicatedHostPatch.Name) {
_patch["name"] = dedicatedHostPatch.Name
}
return
}
// DedicatedHostProfile : DedicatedHostProfile struct
type DedicatedHostProfile struct {
// The product class this dedicated host profile belongs to.
Class *string `json:"class" validate:"required"`
// The disks for a dedicated host with this profile.
Disks []DedicatedHostProfileDisk `json:"disks" validate:"required"`
// The product family this dedicated host profile belongs to
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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"`
// The status of the dedicated host profile:
// - `previous`: This dedicated host profile is an older revision, but remains provisionable
// and usable.
// - `current`: This dedicated host profile is the latest revision.
//
// Revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming
// conventions](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information
// on how generations are defined within a dedicated host profile.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
// The instance profiles usable 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"`
VcpuManufacturer *DedicatedHostProfileVcpuManufacturer `json:"vcpu_manufacturer" validate:"required"`
}
// Constants associated with the DedicatedHostProfile.Family property.
// The product family this dedicated host profile belongs to
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
DedicatedHostProfileFamilyBalancedConst = "balanced"
DedicatedHostProfileFamilyComputeConst = "compute"
DedicatedHostProfileFamilyMemoryConst = "memory"
)
// Constants associated with the DedicatedHostProfile.Status property.
// The status of the dedicated host profile:
// - `previous`: This dedicated host profile is an older revision, but remains provisionable
// and usable.
// - `current`: This dedicated host profile is the latest revision.
//
// Revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming
// conventions](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information
// on how generations are defined within a dedicated host profile.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
DedicatedHostProfileStatusCurrentConst = "current"
DedicatedHostProfileStatusPreviousConst = "previous"
)
// 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 {
err = core.SDKErrorf(err, "", "class-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostProfileDisk)
if err != nil {
err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "family", &obj.Family)
if err != nil {
err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalDedicatedHostProfileMemory)
if err != nil {
err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "socket_count", &obj.SocketCount, UnmarshalDedicatedHostProfileSocket)
if err != nil {
err = core.SDKErrorf(err, "", "socket_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference)
if err != nil {
err = core.SDKErrorf(err, "", "supported_instance_profiles-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalDedicatedHostProfileVcpuArchitecture)
if err != nil {
err = core.SDKErrorf(err, "", "vcpu_architecture-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalDedicatedHostProfileVcpu)
if err != nil {
err = core.SDKErrorf(err, "", "vcpu_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vcpu_manufacturer", &obj.VcpuManufacturer, UnmarshalDedicatedHostProfileVcpuManufacturer)
if err != nil {
err = core.SDKErrorf(err, "", "vcpu_manufacturer-error", common.GetComponentInfo())
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 *PageLink `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 *PageLink `json:"next,omitempty"`
// A page 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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalDedicatedHostProfile)
if err != nil {
err = core.SDKErrorf(err, "", "profiles-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *DedicatedHostProfileCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// 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 {
err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalDedicatedHostProfileDiskQuantity)
if err != nil {
err = core.SDKErrorf(err, "", "quantity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalDedicatedHostProfileDiskSize)
if err != nil {
err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes, UnmarshalDedicatedHostProfileDiskSupportedInterfaces)
if err != nil {
err = core.SDKErrorf(err, "", "supported_instance_interface_types-error", common.GetComponentInfo())
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 may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
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 may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
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"
)
// Constants associated with the DedicatedHostProfileVcpuArchitecture.Value property.
// The VCPU architecture for a dedicated host with this profile.
const (
DedicatedHostProfileVcpuArchitectureValueAmd64Const = "amd64"
DedicatedHostProfileVcpuArchitectureValueS390xConst = "s390x"
)
// 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 {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// DedicatedHostProfileVcpuManufacturer : DedicatedHostProfileVcpuManufacturer struct
type DedicatedHostProfileVcpuManufacturer struct {
// The type for this profile field.
Type *string `json:"type" validate:"required"`
// The VCPU manufacturer for a dedicated host with this profile.
Value *string `json:"value" validate:"required"`
}
// Constants associated with the DedicatedHostProfileVcpuManufacturer.Type property.
// The type for this profile field.
const (
DedicatedHostProfileVcpuManufacturerTypeFixedConst = "fixed"
)
// Constants associated with the DedicatedHostProfileVcpuManufacturer.Value property.
// The VCPU manufacturer for a dedicated host with this profile.
const (
DedicatedHostProfileVcpuManufacturerValueAmdConst = "amd"
DedicatedHostProfileVcpuManufacturerValueIBMConst = "ibm"
DedicatedHostProfileVcpuManufacturerValueIntelConst = "intel"
)
// UnmarshalDedicatedHostProfileVcpuManufacturer unmarshals an instance of DedicatedHostProfileVcpuManufacturer from the specified map of raw messages.
func UnmarshalDedicatedHostProfileVcpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(DedicatedHostProfileVcpuManufacturer)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
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 name for this dedicated host. The name must not be used by another dedicated host in the region. If unspecified,
// the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) 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) will be 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 {
err = core.SDKErrorf(err, "", "instance_placement_enabled-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
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 *Deleted `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 name for this dedicated host. The name is unique across all dedicated hosts in the region.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the DedicatedHostReference.ResourceType property.
// The resource type.
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 {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
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 changed.
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. Created with:
// - The first rule, named `allow-inbound`, allowing ICMP, TCP and UDP inbound traffic.
// - The second rule, named `allow-outbound`, allowing ICMP, TCP, and UDP outbound
// traffic.
//
// 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 resides in.
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 {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem)
if err != nil {
err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// DefaultRoutingTable : DefaultRoutingTable struct
type DefaultRoutingTable struct {
// The filters specifying the resources that may create routes in this routing table.
//
// Created with filters allowing `vpn_gateway` and `vpn_server` resources to create routes, but filters may be added or
// removed with subsequent requests.
//
// The resources and types of filters supported by this property is expected to
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"`
// The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these
// sources.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"`
// The date and time that this routing table was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The CRN for this VPC routing table.
CRN *string `json:"crn" 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 changed.
Name *string `json:"name" validate:"required"`
// The resource group for this routing table.
ResourceGroup *ResourceGroupReference `json:"resource_group" 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.
//
// Set to `false` at VPC creation, but may be updated with subsequent requests.
//
// 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 in a subnet in the route's `zone` that is
// able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of 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 the internet.
//
// Set to `false` at VPC creation, but may be updated with subsequent requests.
//
// Incoming traffic will be routed according to the routing table with two exceptions:
// - Traffic destined for IP addresses associated with public gateways will not be
// subject to routes in this routing table.
// - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop`
// is an IP address in a subnet in the route's `zone` that is able to accept traffic.
// Therefore, if an incoming packet matches a route with a `next_hop` of a VPN
// gateway connection, the packet will be dropped.
RouteInternetIngress *bool `json:"route_internet_ingress" validate:"required"`
// Indicates whether this routing table is used to route traffic that originates from from [Transit
// Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC.
//
// Set to `false` at VPC creation, but may be updated with subsequent requests.
//
// 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 in a subnet in the route's `zone` that is
// able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of 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.
//
// Set to `false` at VPC creation, but may be updated with subsequent requests.
//
// 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 in a subnet in the route's `zone` that is
// able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of 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.AdvertiseRoutesTo property.
// An ingress source that routes can be advertised to:
//
// - `direct_link` (requires `route_direct_link_ingress` be set to `true`)
// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`).
const (
DefaultRoutingTableAdvertiseRoutesToDirectLinkConst = "direct_link"
DefaultRoutingTableAdvertiseRoutesToTransitGatewayConst = "transit_gateway"
)
// Constants associated with the DefaultRoutingTable.LifecycleState property.
// The lifecycle state of the routing table.
const (
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.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter)
if err != nil {
err = core.SDKErrorf(err, "", "accept_routes_from-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo)
if err != nil {
err = core.SDKErrorf(err, "", "advertise_routes_to-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault)
if err != nil {
err = core.SDKErrorf(err, "", "is_default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress)
if err != nil {
err = core.SDKErrorf(err, "", "route_direct_link_ingress-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress)
if err != nil {
err = core.SDKErrorf(err, "", "route_internet_ingress-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress)
if err != nil {
err = core.SDKErrorf(err, "", "route_transit_gateway_ingress-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress)
if err != nil {
err = core.SDKErrorf(err, "", "route_vpc_zone_ingress-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference)
if err != nil {
err = core.SDKErrorf(err, "", "routes-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo())
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 CRN for this security group.
CRN *string `json:"crn" validate:"required"`
// The URL for this security group.
Href *string `json:"href" validate:"required"`
// The unique identifier for this security group.
ID *string `json:"id" validate:"required"`
// The name for the default security group for a VPC. The name will be a hyphenated list of randomly-selected words at
// creation, but may changed.
Name *string `json:"name" validate:"required"`
// The resource group for this security group.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The rules for the default security group for a VPC. Created with:
// - A rule allowing inbound ICMP, TCP and UDP traffic from other interfaces in the
// VPC's default security group
// - A rule allowing outbound ICMP, TCP and UDP traffic to any destination
//
// Rules for the default security group may be changed, added or removed.
Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"`
// The targets for this security group.
Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"`
// The VPC this security group resides in.
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 {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule)
if err != nil {
err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference)
if err != nil {
err = core.SDKErrorf(err, "", "targets-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// DeleteBackupPolicyOptions : The DeleteBackupPolicy options.
type DeleteBackupPolicyOptions struct {
// The backup policy identifier.
ID *string `json:"id" validate:"required,ne="`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteBackupPolicyOptions : Instantiate DeleteBackupPolicyOptions
func (*VpcV1) NewDeleteBackupPolicyOptions(id string) *DeleteBackupPolicyOptions {
return &DeleteBackupPolicyOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *DeleteBackupPolicyOptions) SetID(id string) *DeleteBackupPolicyOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *DeleteBackupPolicyOptions) SetIfMatch(ifMatch string) *DeleteBackupPolicyOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteBackupPolicyOptions) SetHeaders(param map[string]string) *DeleteBackupPolicyOptions {
options.Headers = param
return options
}
// DeleteBackupPolicyPlanOptions : The DeleteBackupPolicyPlan options.
type DeleteBackupPolicyPlanOptions struct {
// The backup policy identifier.
BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="`
// The backup policy plan identifier.
ID *string `json:"id" validate:"required,ne="`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteBackupPolicyPlanOptions : Instantiate DeleteBackupPolicyPlanOptions
func (*VpcV1) NewDeleteBackupPolicyPlanOptions(backupPolicyID string, id string) *DeleteBackupPolicyPlanOptions {
return &DeleteBackupPolicyPlanOptions{
BackupPolicyID: core.StringPtr(backupPolicyID),
ID: core.StringPtr(id),
}
}
// SetBackupPolicyID : Allow user to set BackupPolicyID
func (_options *DeleteBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *DeleteBackupPolicyPlanOptions {
_options.BackupPolicyID = core.StringPtr(backupPolicyID)
return _options
}
// SetID : Allow user to set ID
func (_options *DeleteBackupPolicyPlanOptions) SetID(id string) *DeleteBackupPolicyPlanOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *DeleteBackupPolicyPlanOptions) SetIfMatch(ifMatch string) *DeleteBackupPolicyPlanOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteBackupPolicyPlanOptions) SetHeaders(param map[string]string) *DeleteBackupPolicyPlanOptions {
options.Headers = param
return options
}
// DeleteBareMetalServerNetworkAttachmentOptions : The DeleteBareMetalServerNetworkAttachment options.
type DeleteBareMetalServerNetworkAttachmentOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// The bare metal server network attachment identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteBareMetalServerNetworkAttachmentOptions : Instantiate DeleteBareMetalServerNetworkAttachmentOptions
func (*VpcV1) NewDeleteBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string) *DeleteBareMetalServerNetworkAttachmentOptions {
return &DeleteBareMetalServerNetworkAttachmentOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
ID: core.StringPtr(id),
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *DeleteBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *DeleteBareMetalServerNetworkAttachmentOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetID : Allow user to set ID
func (_options *DeleteBareMetalServerNetworkAttachmentOptions) SetID(id string) *DeleteBareMetalServerNetworkAttachmentOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerNetworkAttachmentOptions {
options.Headers = param
return options
}
// DeleteBareMetalServerNetworkInterfaceOptions : The DeleteBareMetalServerNetworkInterface options.
type DeleteBareMetalServerNetworkInterfaceOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// The bare metal server network interface identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteBareMetalServerNetworkInterfaceOptions : Instantiate DeleteBareMetalServerNetworkInterfaceOptions
func (*VpcV1) NewDeleteBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string) *DeleteBareMetalServerNetworkInterfaceOptions {
return &DeleteBareMetalServerNetworkInterfaceOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
ID: core.StringPtr(id),
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *DeleteBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *DeleteBareMetalServerNetworkInterfaceOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetID : Allow user to set ID
func (_options *DeleteBareMetalServerNetworkInterfaceOptions) SetID(id string) *DeleteBareMetalServerNetworkInterfaceOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerNetworkInterfaceOptions {
options.Headers = param
return options
}
// DeleteBareMetalServerOptions : The DeleteBareMetalServer options.
type DeleteBareMetalServerOptions struct {
// The bare metal server identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteBareMetalServerOptions : Instantiate DeleteBareMetalServerOptions
func (*VpcV1) NewDeleteBareMetalServerOptions(id string) *DeleteBareMetalServerOptions {
return &DeleteBareMetalServerOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *DeleteBareMetalServerOptions) SetID(id string) *DeleteBareMetalServerOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteBareMetalServerOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerOptions {
options.Headers = param
return options
}
// DeleteClusterNetworkInterfaceOptions : The DeleteClusterNetworkInterface options.
type DeleteClusterNetworkInterfaceOptions struct {
// The cluster network identifier.
ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="`
// The cluster network interface identifier.
ID *string `json:"id" validate:"required,ne="`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteClusterNetworkInterfaceOptions : Instantiate DeleteClusterNetworkInterfaceOptions
func (*VpcV1) NewDeleteClusterNetworkInterfaceOptions(clusterNetworkID string, id string) *DeleteClusterNetworkInterfaceOptions {
return &DeleteClusterNetworkInterfaceOptions{
ClusterNetworkID: core.StringPtr(clusterNetworkID),
ID: core.StringPtr(id),
}
}
// SetClusterNetworkID : Allow user to set ClusterNetworkID
func (_options *DeleteClusterNetworkInterfaceOptions) SetClusterNetworkID(clusterNetworkID string) *DeleteClusterNetworkInterfaceOptions {
_options.ClusterNetworkID = core.StringPtr(clusterNetworkID)
return _options
}
// SetID : Allow user to set ID
func (_options *DeleteClusterNetworkInterfaceOptions) SetID(id string) *DeleteClusterNetworkInterfaceOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *DeleteClusterNetworkInterfaceOptions) SetIfMatch(ifMatch string) *DeleteClusterNetworkInterfaceOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteClusterNetworkInterfaceOptions) SetHeaders(param map[string]string) *DeleteClusterNetworkInterfaceOptions {
options.Headers = param
return options
}
// DeleteClusterNetworkOptions : The DeleteClusterNetwork options.
type DeleteClusterNetworkOptions struct {
// The cluster network identifier.
ID *string `json:"id" validate:"required,ne="`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteClusterNetworkOptions : Instantiate DeleteClusterNetworkOptions
func (*VpcV1) NewDeleteClusterNetworkOptions(id string) *DeleteClusterNetworkOptions {
return &DeleteClusterNetworkOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *DeleteClusterNetworkOptions) SetID(id string) *DeleteClusterNetworkOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *DeleteClusterNetworkOptions) SetIfMatch(ifMatch string) *DeleteClusterNetworkOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteClusterNetworkOptions) SetHeaders(param map[string]string) *DeleteClusterNetworkOptions {
options.Headers = param
return options
}
// DeleteClusterNetworkSubnetOptions : The DeleteClusterNetworkSubnet options.
type DeleteClusterNetworkSubnetOptions struct {
// The cluster network identifier.
ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="`
// The cluster network subnet identifier.
ID *string `json:"id" validate:"required,ne="`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteClusterNetworkSubnetOptions : Instantiate DeleteClusterNetworkSubnetOptions
func (*VpcV1) NewDeleteClusterNetworkSubnetOptions(clusterNetworkID string, id string) *DeleteClusterNetworkSubnetOptions {
return &DeleteClusterNetworkSubnetOptions{
ClusterNetworkID: core.StringPtr(clusterNetworkID),
ID: core.StringPtr(id),
}
}
// SetClusterNetworkID : Allow user to set ClusterNetworkID
func (_options *DeleteClusterNetworkSubnetOptions) SetClusterNetworkID(clusterNetworkID string) *DeleteClusterNetworkSubnetOptions {
_options.ClusterNetworkID = core.StringPtr(clusterNetworkID)
return _options
}
// SetID : Allow user to set ID
func (_options *DeleteClusterNetworkSubnetOptions) SetID(id string) *DeleteClusterNetworkSubnetOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *DeleteClusterNetworkSubnetOptions) SetIfMatch(ifMatch string) *DeleteClusterNetworkSubnetOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteClusterNetworkSubnetOptions) SetHeaders(param map[string]string) *DeleteClusterNetworkSubnetOptions {
options.Headers = param
return options
}
// DeleteClusterNetworkSubnetReservedIPOptions : The DeleteClusterNetworkSubnetReservedIP options.
type DeleteClusterNetworkSubnetReservedIPOptions struct {
// The cluster network identifier.
ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="`
// The cluster network subnet identifier.
ClusterNetworkSubnetID *string `json:"cluster_network_subnet_id" validate:"required,ne="`
// The cluster network subnet reserved IP identifier.
ID *string `json:"id" validate:"required,ne="`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteClusterNetworkSubnetReservedIPOptions : Instantiate DeleteClusterNetworkSubnetReservedIPOptions
func (*VpcV1) NewDeleteClusterNetworkSubnetReservedIPOptions(clusterNetworkID string, clusterNetworkSubnetID string, id string) *DeleteClusterNetworkSubnetReservedIPOptions {
return &DeleteClusterNetworkSubnetReservedIPOptions{
ClusterNetworkID: core.StringPtr(clusterNetworkID),
ClusterNetworkSubnetID: core.StringPtr(clusterNetworkSubnetID),
ID: core.StringPtr(id),
}
}
// SetClusterNetworkID : Allow user to set ClusterNetworkID
func (_options *DeleteClusterNetworkSubnetReservedIPOptions) SetClusterNetworkID(clusterNetworkID string) *DeleteClusterNetworkSubnetReservedIPOptions {
_options.ClusterNetworkID = core.StringPtr(clusterNetworkID)
return _options
}
// SetClusterNetworkSubnetID : Allow user to set ClusterNetworkSubnetID
func (_options *DeleteClusterNetworkSubnetReservedIPOptions) SetClusterNetworkSubnetID(clusterNetworkSubnetID string) *DeleteClusterNetworkSubnetReservedIPOptions {
_options.ClusterNetworkSubnetID = core.StringPtr(clusterNetworkSubnetID)
return _options
}
// SetID : Allow user to set ID
func (_options *DeleteClusterNetworkSubnetReservedIPOptions) SetID(id string) *DeleteClusterNetworkSubnetReservedIPOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *DeleteClusterNetworkSubnetReservedIPOptions) SetIfMatch(ifMatch string) *DeleteClusterNetworkSubnetReservedIPOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteClusterNetworkSubnetReservedIPOptions) SetHeaders(param map[string]string) *DeleteClusterNetworkSubnetReservedIPOptions {
options.Headers = param
return options
}
// DeleteDedicatedHostGroupOptions : The DeleteDedicatedHostGroup options.
type DeleteDedicatedHostGroupOptions struct {
// The dedicated host group identifier.
ID *string `json:"id" 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 `json:"id" 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 `json:"id" 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 `json:"id" 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 `json:"id" 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 `json:"id" 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
}
// DeleteImageExportJobOptions : The DeleteImageExportJob options.
type DeleteImageExportJobOptions struct {
// The image identifier.
ImageID *string `json:"image_id" validate:"required,ne="`
// The image export job identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteImageExportJobOptions : Instantiate DeleteImageExportJobOptions
func (*VpcV1) NewDeleteImageExportJobOptions(imageID string, id string) *DeleteImageExportJobOptions {
return &DeleteImageExportJobOptions{
ImageID: core.StringPtr(imageID),
ID: core.StringPtr(id),
}
}
// SetImageID : Allow user to set ImageID
func (_options *DeleteImageExportJobOptions) SetImageID(imageID string) *DeleteImageExportJobOptions {
_options.ImageID = core.StringPtr(imageID)
return _options
}
// SetID : Allow user to set ID
func (_options *DeleteImageExportJobOptions) SetID(id string) *DeleteImageExportJobOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteImageExportJobOptions) SetHeaders(param map[string]string) *DeleteImageExportJobOptions {
options.Headers = param
return options
}
// DeleteImageOptions : The DeleteImage options.
type DeleteImageOptions struct {
// The image identifier.
ID *string `json:"id" 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
}
// DeleteInstanceClusterNetworkAttachmentOptions : The DeleteInstanceClusterNetworkAttachment options.
type DeleteInstanceClusterNetworkAttachmentOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance cluster network attachment identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteInstanceClusterNetworkAttachmentOptions : Instantiate DeleteInstanceClusterNetworkAttachmentOptions
func (*VpcV1) NewDeleteInstanceClusterNetworkAttachmentOptions(instanceID string, id string) *DeleteInstanceClusterNetworkAttachmentOptions {
return &DeleteInstanceClusterNetworkAttachmentOptions{
InstanceID: core.StringPtr(instanceID),
ID: core.StringPtr(id),
}
}
// SetInstanceID : Allow user to set InstanceID
func (_options *DeleteInstanceClusterNetworkAttachmentOptions) SetInstanceID(instanceID string) *DeleteInstanceClusterNetworkAttachmentOptions {
_options.InstanceID = core.StringPtr(instanceID)
return _options
}
// SetID : Allow user to set ID
func (_options *DeleteInstanceClusterNetworkAttachmentOptions) SetID(id string) *DeleteInstanceClusterNetworkAttachmentOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteInstanceClusterNetworkAttachmentOptions) SetHeaders(param map[string]string) *DeleteInstanceClusterNetworkAttachmentOptions {
options.Headers = param
return options
}
// DeleteInstanceGroupLoadBalancerOptions : The DeleteInstanceGroupLoadBalancer options.
type DeleteInstanceGroupLoadBalancerOptions struct {
// The instance group identifier.
InstanceGroupID *string `json:"instance_group_id" 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
}
// DeleteInstanceGroupManagerActionOptions : The DeleteInstanceGroupManagerAction options.
type DeleteInstanceGroupManagerActionOptions struct {
// The instance group identifier.
InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="`
// The instance group manager identifier.
InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="`
// The instance group manager action identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteInstanceGroupManagerActionOptions : Instantiate DeleteInstanceGroupManagerActionOptions
func (*VpcV1) NewDeleteInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string) *DeleteInstanceGroupManagerActionOptions {
return &DeleteInstanceGroupManagerActionOptions{
InstanceGroupID: core.StringPtr(instanceGroupID),
InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID),
ID: core.StringPtr(id),
}
}
// SetInstanceGroupID : Allow user to set InstanceGroupID
func (_options *DeleteInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerActionOptions {
_options.InstanceGroupID = core.StringPtr(instanceGroupID)
return _options
}
// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID
func (_options *DeleteInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *DeleteInstanceGroupManagerActionOptions {
_options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID)
return _options
}
// SetID : Allow user to set ID
func (_options *DeleteInstanceGroupManagerActionOptions) SetID(id string) *DeleteInstanceGroupManagerActionOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerActionOptions {
options.Headers = param
return options
}
// DeleteInstanceGroupManagerOptions : The DeleteInstanceGroupManager options.
type DeleteInstanceGroupManagerOptions struct {
// The instance group identifier.
InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="`
// The instance group manager identifier.
ID *string `json:"id" 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 `json:"instance_group_id" validate:"required,ne="`
// The instance group manager identifier.
InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="`
// The instance group manager policy identifier.
ID *string `json:"id" 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 `json:"instance_group_id" validate:"required,ne="`
// The instance group membership identifier.
ID *string `json:"id" 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 `json:"instance_group_id" 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 `json:"id" 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
}
// DeleteInstanceNetworkAttachmentOptions : The DeleteInstanceNetworkAttachment options.
type DeleteInstanceNetworkAttachmentOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance network attachment identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteInstanceNetworkAttachmentOptions : Instantiate DeleteInstanceNetworkAttachmentOptions
func (*VpcV1) NewDeleteInstanceNetworkAttachmentOptions(instanceID string, id string) *DeleteInstanceNetworkAttachmentOptions {
return &DeleteInstanceNetworkAttachmentOptions{
InstanceID: core.StringPtr(instanceID),
ID: core.StringPtr(id),
}
}
// SetInstanceID : Allow user to set InstanceID
func (_options *DeleteInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *DeleteInstanceNetworkAttachmentOptions {
_options.InstanceID = core.StringPtr(instanceID)
return _options
}
// SetID : Allow user to set ID
func (_options *DeleteInstanceNetworkAttachmentOptions) SetID(id string) *DeleteInstanceNetworkAttachmentOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *DeleteInstanceNetworkAttachmentOptions {
options.Headers = param
return options
}
// DeleteInstanceNetworkInterfaceOptions : The DeleteInstanceNetworkInterface options.
type DeleteInstanceNetworkInterfaceOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance network interface identifier.
ID *string `json:"id" 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 virtual server instance identifier.
ID *string `json:"id" validate:"required,ne="`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
IfMatch *string `json:"If-Match,omitempty"`
// 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
}
// SetIfMatch : Allow user to set IfMatch
func (_options *DeleteInstanceOptions) SetIfMatch(ifMatch string) *DeleteInstanceOptions {
_options.IfMatch = core.StringPtr(ifMatch)
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 `json:"id" 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 virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The volume attachment identifier.
ID *string `json:"id" 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 `json:"id" 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 `json:"id" 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 `json:"load_balancer_id" validate:"required,ne="`
// The listener identifier.
ID *string `json:"id" 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 `json:"load_balancer_id" validate:"required,ne="`
// The listener identifier.
ListenerID *string `json:"listener_id" validate:"required,ne="`
// The policy identifier.
ID *string `json:"id" 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 `json:"load_balancer_id" validate:"required,ne="`
// The listener identifier.
ListenerID *string `json:"listener_id" validate:"required,ne="`
// The policy identifier.
PolicyID *string `json:"policy_id" validate:"required,ne="`
// The rule identifier.
ID *string `json:"id" 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 `json:"id" validate:"required,ne="`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
IfMatch *string `json:"If-Match,omitempty"`
// 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
}
// SetIfMatch : Allow user to set IfMatch
func (_options *DeleteLoadBalancerOptions) SetIfMatch(ifMatch string) *DeleteLoadBalancerOptions {
_options.IfMatch = core.StringPtr(ifMatch)
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 `json:"load_balancer_id" validate:"required,ne="`
// The pool identifier.
PoolID *string `json:"pool_id" validate:"required,ne="`
// The member identifier.
ID *string `json:"id" 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 `json:"load_balancer_id" validate:"required,ne="`
// The pool identifier.
ID *string `json:"id" 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 `json:"id" 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 `json:"network_acl_id" validate:"required,ne="`
// The rule identifier.
ID *string `json:"id" 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
}
// DeletePlacementGroupOptions : The DeletePlacementGroup options.
type DeletePlacementGroupOptions struct {
// The placement group identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeletePlacementGroupOptions : Instantiate DeletePlacementGroupOptions
func (*VpcV1) NewDeletePlacementGroupOptions(id string) *DeletePlacementGroupOptions {
return &DeletePlacementGroupOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *DeletePlacementGroupOptions) SetID(id string) *DeletePlacementGroupOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeletePlacementGroupOptions) SetHeaders(param map[string]string) *DeletePlacementGroupOptions {
options.Headers = param
return options
}
// DeletePrivatePathServiceGatewayAccountPolicyOptions : The DeletePrivatePathServiceGatewayAccountPolicy options.
type DeletePrivatePathServiceGatewayAccountPolicyOptions struct {
// The private path service gateway identifier.
PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="`
// The account policy identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeletePrivatePathServiceGatewayAccountPolicyOptions : Instantiate DeletePrivatePathServiceGatewayAccountPolicyOptions
func (*VpcV1) NewDeletePrivatePathServiceGatewayAccountPolicyOptions(privatePathServiceGatewayID string, id string) *DeletePrivatePathServiceGatewayAccountPolicyOptions {
return &DeletePrivatePathServiceGatewayAccountPolicyOptions{
PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID),
ID: core.StringPtr(id),
}
}
// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID
func (_options *DeletePrivatePathServiceGatewayAccountPolicyOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *DeletePrivatePathServiceGatewayAccountPolicyOptions {
_options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID)
return _options
}
// SetID : Allow user to set ID
func (_options *DeletePrivatePathServiceGatewayAccountPolicyOptions) SetID(id string) *DeletePrivatePathServiceGatewayAccountPolicyOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeletePrivatePathServiceGatewayAccountPolicyOptions) SetHeaders(param map[string]string) *DeletePrivatePathServiceGatewayAccountPolicyOptions {
options.Headers = param
return options
}
// DeletePrivatePathServiceGatewayOptions : The DeletePrivatePathServiceGateway options.
type DeletePrivatePathServiceGatewayOptions struct {
// The private path service gateway identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeletePrivatePathServiceGatewayOptions : Instantiate DeletePrivatePathServiceGatewayOptions
func (*VpcV1) NewDeletePrivatePathServiceGatewayOptions(id string) *DeletePrivatePathServiceGatewayOptions {
return &DeletePrivatePathServiceGatewayOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *DeletePrivatePathServiceGatewayOptions) SetID(id string) *DeletePrivatePathServiceGatewayOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeletePrivatePathServiceGatewayOptions) SetHeaders(param map[string]string) *DeletePrivatePathServiceGatewayOptions {
options.Headers = param
return options
}
// DeletePublicAddressRangeOptions : The DeletePublicAddressRange options.
type DeletePublicAddressRangeOptions struct {
// The public address range identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeletePublicAddressRangeOptions : Instantiate DeletePublicAddressRangeOptions
func (*VpcV1) NewDeletePublicAddressRangeOptions(id string) *DeletePublicAddressRangeOptions {
return &DeletePublicAddressRangeOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *DeletePublicAddressRangeOptions) SetID(id string) *DeletePublicAddressRangeOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeletePublicAddressRangeOptions) SetHeaders(param map[string]string) *DeletePublicAddressRangeOptions {
options.Headers = param
return options
}
// DeletePublicGatewayOptions : The DeletePublicGateway options.
type DeletePublicGatewayOptions struct {
// The public gateway identifier.
ID *string `json:"id" 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
}
// DeleteReservationOptions : The DeleteReservation options.
type DeleteReservationOptions struct {
// The reservation identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteReservationOptions : Instantiate DeleteReservationOptions
func (*VpcV1) NewDeleteReservationOptions(id string) *DeleteReservationOptions {
return &DeleteReservationOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *DeleteReservationOptions) SetID(id string) *DeleteReservationOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteReservationOptions) SetHeaders(param map[string]string) *DeleteReservationOptions {
options.Headers = param
return options
}
// DeleteSecurityGroupOptions : The DeleteSecurityGroup options.
type DeleteSecurityGroupOptions struct {
// The security group identifier.
ID *string `json:"id" 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 `json:"security_group_id" validate:"required,ne="`
// The rule identifier.
ID *string `json:"id" 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 `json:"security_group_id" validate:"required,ne="`
// The security group target identifier.
ID *string `json:"id" 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
}
// DeleteShareAccessorBindingOptions : The DeleteShareAccessorBinding options.
type DeleteShareAccessorBindingOptions struct {
// The file share identifier.
ShareID *string `json:"share_id" validate:"required,ne="`
// The file share accessor binding identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteShareAccessorBindingOptions : Instantiate DeleteShareAccessorBindingOptions
func (*VpcV1) NewDeleteShareAccessorBindingOptions(shareID string, id string) *DeleteShareAccessorBindingOptions {
return &DeleteShareAccessorBindingOptions{
ShareID: core.StringPtr(shareID),
ID: core.StringPtr(id),
}
}
// SetShareID : Allow user to set ShareID
func (_options *DeleteShareAccessorBindingOptions) SetShareID(shareID string) *DeleteShareAccessorBindingOptions {
_options.ShareID = core.StringPtr(shareID)
return _options
}
// SetID : Allow user to set ID
func (_options *DeleteShareAccessorBindingOptions) SetID(id string) *DeleteShareAccessorBindingOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteShareAccessorBindingOptions) SetHeaders(param map[string]string) *DeleteShareAccessorBindingOptions {
options.Headers = param
return options
}
// DeleteShareMountTargetOptions : The DeleteShareMountTarget options.
type DeleteShareMountTargetOptions struct {
// The file share identifier.
ShareID *string `json:"share_id" validate:"required,ne="`
// The file share mount target identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteShareMountTargetOptions : Instantiate DeleteShareMountTargetOptions
func (*VpcV1) NewDeleteShareMountTargetOptions(shareID string, id string) *DeleteShareMountTargetOptions {
return &DeleteShareMountTargetOptions{
ShareID: core.StringPtr(shareID),
ID: core.StringPtr(id),
}
}
// SetShareID : Allow user to set ShareID
func (_options *DeleteShareMountTargetOptions) SetShareID(shareID string) *DeleteShareMountTargetOptions {
_options.ShareID = core.StringPtr(shareID)
return _options
}
// SetID : Allow user to set ID
func (_options *DeleteShareMountTargetOptions) SetID(id string) *DeleteShareMountTargetOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteShareMountTargetOptions) SetHeaders(param map[string]string) *DeleteShareMountTargetOptions {
options.Headers = param
return options
}
// DeleteShareOptions : The DeleteShare options.
type DeleteShareOptions struct {
// The file share identifier.
ID *string `json:"id" validate:"required,ne="`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteShareOptions : Instantiate DeleteShareOptions
func (*VpcV1) NewDeleteShareOptions(id string) *DeleteShareOptions {
return &DeleteShareOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *DeleteShareOptions) SetID(id string) *DeleteShareOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *DeleteShareOptions) SetIfMatch(ifMatch string) *DeleteShareOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteShareOptions) SetHeaders(param map[string]string) *DeleteShareOptions {
options.Headers = param
return options
}
// DeleteShareSnapshotOptions : The DeleteShareSnapshot options.
type DeleteShareSnapshotOptions struct {
// The file share identifier.
ShareID *string `json:"share_id" validate:"required,ne="`
// The share snapshot identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteShareSnapshotOptions : Instantiate DeleteShareSnapshotOptions
func (*VpcV1) NewDeleteShareSnapshotOptions(shareID string, id string) *DeleteShareSnapshotOptions {
return &DeleteShareSnapshotOptions{
ShareID: core.StringPtr(shareID),
ID: core.StringPtr(id),
}
}
// SetShareID : Allow user to set ShareID
func (_options *DeleteShareSnapshotOptions) SetShareID(shareID string) *DeleteShareSnapshotOptions {
_options.ShareID = core.StringPtr(shareID)
return _options
}
// SetID : Allow user to set ID
func (_options *DeleteShareSnapshotOptions) SetID(id string) *DeleteShareSnapshotOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteShareSnapshotOptions) SetHeaders(param map[string]string) *DeleteShareSnapshotOptions {
options.Headers = param
return options
}
// DeleteShareSourceOptions : The DeleteShareSource options.
type DeleteShareSourceOptions struct {
// The file share identifier.
ShareID *string `json:"share_id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteShareSourceOptions : Instantiate DeleteShareSourceOptions
func (*VpcV1) NewDeleteShareSourceOptions(shareID string) *DeleteShareSourceOptions {
return &DeleteShareSourceOptions{
ShareID: core.StringPtr(shareID),
}
}
// SetShareID : Allow user to set ShareID
func (_options *DeleteShareSourceOptions) SetShareID(shareID string) *DeleteShareSourceOptions {
_options.ShareID = core.StringPtr(shareID)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteShareSourceOptions) SetHeaders(param map[string]string) *DeleteShareSourceOptions {
options.Headers = param
return options
}
// DeleteSnapshotCloneOptions : The DeleteSnapshotClone options.
type DeleteSnapshotCloneOptions struct {
// The snapshot identifier.
ID *string `json:"id" validate:"required,ne="`
// The zone name.
ZoneName *string `json:"zone_name" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteSnapshotCloneOptions : Instantiate DeleteSnapshotCloneOptions
func (*VpcV1) NewDeleteSnapshotCloneOptions(id string, zoneName string) *DeleteSnapshotCloneOptions {
return &DeleteSnapshotCloneOptions{
ID: core.StringPtr(id),
ZoneName: core.StringPtr(zoneName),
}
}
// SetID : Allow user to set ID
func (_options *DeleteSnapshotCloneOptions) SetID(id string) *DeleteSnapshotCloneOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetZoneName : Allow user to set ZoneName
func (_options *DeleteSnapshotCloneOptions) SetZoneName(zoneName string) *DeleteSnapshotCloneOptions {
_options.ZoneName = core.StringPtr(zoneName)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteSnapshotCloneOptions) SetHeaders(param map[string]string) *DeleteSnapshotCloneOptions {
options.Headers = param
return options
}
// DeleteSnapshotConsistencyGroupOptions : The DeleteSnapshotConsistencyGroup options.
type DeleteSnapshotConsistencyGroupOptions struct {
// The snapshot consistency group identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteSnapshotConsistencyGroupOptions : Instantiate DeleteSnapshotConsistencyGroupOptions
func (*VpcV1) NewDeleteSnapshotConsistencyGroupOptions(id string) *DeleteSnapshotConsistencyGroupOptions {
return &DeleteSnapshotConsistencyGroupOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *DeleteSnapshotConsistencyGroupOptions) SetID(id string) *DeleteSnapshotConsistencyGroupOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteSnapshotConsistencyGroupOptions) SetHeaders(param map[string]string) *DeleteSnapshotConsistencyGroupOptions {
options.Headers = param
return options
}
// DeleteSnapshotOptions : The DeleteSnapshot options.
type DeleteSnapshotOptions struct {
// The snapshot identifier.
ID *string `json:"id" validate:"required,ne="`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteSnapshotOptions : Instantiate DeleteSnapshotOptions
func (*VpcV1) NewDeleteSnapshotOptions(id string) *DeleteSnapshotOptions {
return &DeleteSnapshotOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *DeleteSnapshotOptions) SetID(id string) *DeleteSnapshotOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *DeleteSnapshotOptions) SetIfMatch(ifMatch string) *DeleteSnapshotOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteSnapshotOptions) SetHeaders(param map[string]string) *DeleteSnapshotOptions {
options.Headers = param
return options
}
// DeleteSnapshotsOptions : The DeleteSnapshots options.
type DeleteSnapshotsOptions struct {
// Filters the collection to resources with a `source_volume.id` property matching the specified identifier.
SourceVolumeID *string `json:"source_volume.id" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteSnapshotsOptions : Instantiate DeleteSnapshotsOptions
func (*VpcV1) NewDeleteSnapshotsOptions(sourceVolumeID string) *DeleteSnapshotsOptions {
return &DeleteSnapshotsOptions{
SourceVolumeID: core.StringPtr(sourceVolumeID),
}
}
// SetSourceVolumeID : Allow user to set SourceVolumeID
func (_options *DeleteSnapshotsOptions) SetSourceVolumeID(sourceVolumeID string) *DeleteSnapshotsOptions {
_options.SourceVolumeID = core.StringPtr(sourceVolumeID)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteSnapshotsOptions) SetHeaders(param map[string]string) *DeleteSnapshotsOptions {
options.Headers = param
return options
}
// DeleteSubnetOptions : The DeleteSubnet options.
type DeleteSubnetOptions struct {
// The subnet identifier.
ID *string `json:"id" 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 `json:"subnet_id" validate:"required,ne="`
// The reserved IP identifier.
ID *string `json:"id" 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
}
// DeleteVirtualNetworkInterfacesOptions : The DeleteVirtualNetworkInterfaces options.
type DeleteVirtualNetworkInterfacesOptions struct {
// The virtual network interface identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteVirtualNetworkInterfacesOptions : Instantiate DeleteVirtualNetworkInterfacesOptions
func (*VpcV1) NewDeleteVirtualNetworkInterfacesOptions(id string) *DeleteVirtualNetworkInterfacesOptions {
return &DeleteVirtualNetworkInterfacesOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *DeleteVirtualNetworkInterfacesOptions) SetID(id string) *DeleteVirtualNetworkInterfacesOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteVirtualNetworkInterfacesOptions) SetHeaders(param map[string]string) *DeleteVirtualNetworkInterfacesOptions {
options.Headers = param
return options
}
// DeleteVolumeOptions : The DeleteVolume options.
type DeleteVolumeOptions struct {
// The volume identifier.
ID *string `json:"id" validate:"required,ne="`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
IfMatch *string `json:"If-Match,omitempty"`
// 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
}
// SetIfMatch : Allow user to set IfMatch
func (_options *DeleteVolumeOptions) SetIfMatch(ifMatch string) *DeleteVolumeOptions {
_options.IfMatch = core.StringPtr(ifMatch)
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 `json:"vpc_id" validate:"required,ne="`
// The prefix identifier.
ID *string `json:"id" 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
}
// DeleteVPCDnsResolutionBindingOptions : The DeleteVPCDnsResolutionBinding options.
type DeleteVPCDnsResolutionBindingOptions struct {
// The VPC identifier.
VPCID *string `json:"vpc_id" validate:"required,ne="`
// The DNS resolution binding identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteVPCDnsResolutionBindingOptions : Instantiate DeleteVPCDnsResolutionBindingOptions
func (*VpcV1) NewDeleteVPCDnsResolutionBindingOptions(vpcID string, id string) *DeleteVPCDnsResolutionBindingOptions {
return &DeleteVPCDnsResolutionBindingOptions{
VPCID: core.StringPtr(vpcID),
ID: core.StringPtr(id),
}
}
// SetVPCID : Allow user to set VPCID
func (_options *DeleteVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *DeleteVPCDnsResolutionBindingOptions {
_options.VPCID = core.StringPtr(vpcID)
return _options
}
// SetID : Allow user to set ID
func (_options *DeleteVPCDnsResolutionBindingOptions) SetID(id string) *DeleteVPCDnsResolutionBindingOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *DeleteVPCDnsResolutionBindingOptions {
options.Headers = param
return options
}
// DeleteVPCOptions : The DeleteVPC options.
type DeleteVPCOptions struct {
// The VPC identifier.
ID *string `json:"id" validate:"required,ne="`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
IfMatch *string `json:"If-Match,omitempty"`
// 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
}
// SetIfMatch : Allow user to set IfMatch
func (_options *DeleteVPCOptions) SetIfMatch(ifMatch string) *DeleteVPCOptions {
_options.IfMatch = core.StringPtr(ifMatch)
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 `json:"vpc_id" validate:"required,ne="`
// The route identifier.
ID *string `json:"id" 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 `json:"vpc_id" validate:"required,ne="`
// The routing table identifier.
ID *string `json:"id" validate:"required,ne="`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
IfMatch *string `json:"If-Match,omitempty"`
// 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
}
// SetIfMatch : Allow user to set IfMatch
func (_options *DeleteVPCRoutingTableOptions) SetIfMatch(ifMatch string) *DeleteVPCRoutingTableOptions {
_options.IfMatch = core.StringPtr(ifMatch)
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 `json:"vpc_id" validate:"required,ne="`
// The routing table identifier.
RoutingTableID *string `json:"routing_table_id" validate:"required,ne="`
// The VPC routing table route identifier.
ID *string `json:"id" 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 `json:"vpn_gateway_id" validate:"required,ne="`
// The VPN gateway connection identifier.
ID *string `json:"id" 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 `json:"id" 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
}
// DeleteVPNServerClientOptions : The DeleteVPNServerClient options.
type DeleteVPNServerClientOptions struct {
// The VPN server identifier.
VPNServerID *string `json:"vpn_server_id" validate:"required,ne="`
// The VPN client identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteVPNServerClientOptions : Instantiate DeleteVPNServerClientOptions
func (*VpcV1) NewDeleteVPNServerClientOptions(vpnServerID string, id string) *DeleteVPNServerClientOptions {
return &DeleteVPNServerClientOptions{
VPNServerID: core.StringPtr(vpnServerID),
ID: core.StringPtr(id),
}
}
// SetVPNServerID : Allow user to set VPNServerID
func (_options *DeleteVPNServerClientOptions) SetVPNServerID(vpnServerID string) *DeleteVPNServerClientOptions {
_options.VPNServerID = core.StringPtr(vpnServerID)
return _options
}
// SetID : Allow user to set ID
func (_options *DeleteVPNServerClientOptions) SetID(id string) *DeleteVPNServerClientOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteVPNServerClientOptions) SetHeaders(param map[string]string) *DeleteVPNServerClientOptions {
options.Headers = param
return options
}
// DeleteVPNServerOptions : The DeleteVPNServer options.
type DeleteVPNServerOptions struct {
// The VPN server identifier.
ID *string `json:"id" validate:"required,ne="`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteVPNServerOptions : Instantiate DeleteVPNServerOptions
func (*VpcV1) NewDeleteVPNServerOptions(id string) *DeleteVPNServerOptions {
return &DeleteVPNServerOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *DeleteVPNServerOptions) SetID(id string) *DeleteVPNServerOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *DeleteVPNServerOptions) SetIfMatch(ifMatch string) *DeleteVPNServerOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteVPNServerOptions) SetHeaders(param map[string]string) *DeleteVPNServerOptions {
options.Headers = param
return options
}
// DeleteVPNServerRouteOptions : The DeleteVPNServerRoute options.
type DeleteVPNServerRouteOptions struct {
// The VPN server identifier.
VPNServerID *string `json:"vpn_server_id" validate:"required,ne="`
// The VPN route identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeleteVPNServerRouteOptions : Instantiate DeleteVPNServerRouteOptions
func (*VpcV1) NewDeleteVPNServerRouteOptions(vpnServerID string, id string) *DeleteVPNServerRouteOptions {
return &DeleteVPNServerRouteOptions{
VPNServerID: core.StringPtr(vpnServerID),
ID: core.StringPtr(id),
}
}
// SetVPNServerID : Allow user to set VPNServerID
func (_options *DeleteVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *DeleteVPNServerRouteOptions {
_options.VPNServerID = core.StringPtr(vpnServerID)
return _options
}
// SetID : Allow user to set ID
func (_options *DeleteVPNServerRouteOptions) SetID(id string) *DeleteVPNServerRouteOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeleteVPNServerRouteOptions) SetHeaders(param map[string]string) *DeleteVPNServerRouteOptions {
options.Headers = param
return options
}
// Deleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary
// information.
type Deleted struct {
// A link to documentation about deleted resources.
MoreInfo *string `json:"more_info" validate:"required"`
}
// UnmarshalDeleted unmarshals an instance of Deleted from the specified map of raw messages.
func UnmarshalDeleted(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(Deleted)
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions : The DenyPrivatePathServiceGatewayEndpointGatewayBinding options.
type DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions struct {
// The private path service gateway identifier.
PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="`
// The endpoint gateway binding identifier.
ID *string `json:"id" validate:"required,ne="`
// Indicates whether this will become the access policy for any `pending` and future endpoint gateway bindings from the
// same account.
//
// If set to `true`:
// - If the account has an existing access policy, that policy will be updated to `deny`.
// Otherwise, a new `deny` access policy will be created for the account.
// - All `pending` endpoint gateway bindings for the account will be denied.
//
// If set to `false`:
// - No access policies will be created or updated
// - All `pending` endpoint gateway bindings for the account will remain `pending`.
SetAccountPolicy *bool `json:"set_account_policy,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDenyPrivatePathServiceGatewayEndpointGatewayBindingOptions : Instantiate DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions
func (*VpcV1) NewDenyPrivatePathServiceGatewayEndpointGatewayBindingOptions(privatePathServiceGatewayID string, id string) *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions {
return &DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions{
PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID),
ID: core.StringPtr(id),
}
}
// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID
func (_options *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions {
_options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID)
return _options
}
// SetID : Allow user to set ID
func (_options *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetID(id string) *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetSetAccountPolicy : Allow user to set SetAccountPolicy
func (_options *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetSetAccountPolicy(setAccountPolicy bool) *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions {
_options.SetAccountPolicy = core.BoolPtr(setAccountPolicy)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetHeaders(param map[string]string) *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions {
options.Headers = param
return options
}
// DeprecateImageOptions : The DeprecateImage options.
type DeprecateImageOptions struct {
// The image identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDeprecateImageOptions : Instantiate DeprecateImageOptions
func (*VpcV1) NewDeprecateImageOptions(id string) *DeprecateImageOptions {
return &DeprecateImageOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *DeprecateImageOptions) SetID(id string) *DeprecateImageOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DeprecateImageOptions) SetHeaders(param map[string]string) *DeprecateImageOptions {
options.Headers = param
return options
}
// DisconnectVPNClientOptions : The DisconnectVPNClient options.
type DisconnectVPNClientOptions struct {
// The VPN server identifier.
VPNServerID *string `json:"vpn_server_id" validate:"required,ne="`
// The VPN client identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewDisconnectVPNClientOptions : Instantiate DisconnectVPNClientOptions
func (*VpcV1) NewDisconnectVPNClientOptions(vpnServerID string, id string) *DisconnectVPNClientOptions {
return &DisconnectVPNClientOptions{
VPNServerID: core.StringPtr(vpnServerID),
ID: core.StringPtr(id),
}
}
// SetVPNServerID : Allow user to set VPNServerID
func (_options *DisconnectVPNClientOptions) SetVPNServerID(vpnServerID string) *DisconnectVPNClientOptions {
_options.VPNServerID = core.StringPtr(vpnServerID)
return _options
}
// SetID : Allow user to set ID
func (_options *DisconnectVPNClientOptions) SetID(id string) *DisconnectVPNClientOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *DisconnectVPNClientOptions) SetHeaders(param map[string]string) *DisconnectVPNClientOptions {
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
// Services 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
asPatch() map[string]interface{}
}
// 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 {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the EncryptionKeyIdentity
func (encryptionKeyIdentity *EncryptionKeyIdentity) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(encryptionKeyIdentity.CRN) {
_patch["crn"] = encryptionKeyIdentity.CRN
}
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
// Services 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 {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// EndpointGateway : EndpointGateway struct
type EndpointGateway struct {
// Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in
// has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`.
AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding" validate:"required"`
// 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`: No abnormal behavior detected
// - `degraded`: Experiencing 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"`
// The reserved IPs bound to this endpoint gateway.
Ips []ReservedIPReference `json:"ips" validate:"required"`
// The reasons for the current `lifecycle_state` (if any).
LifecycleReasons []EndpointGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"`
// The lifecycle state of the endpoint gateway.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC.
Name *string `json:"name" validate:"required"`
// The resource group for this endpoint gateway.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The security groups targeting this endpoint gateway.
SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"`
// The fully qualified domain name for the target service. The domain name may have a wildcard prefix.
// Deprecated: this field is deprecated and may be removed in a future release.
ServiceEndpoint *string `json:"service_endpoint,omitempty"`
// The fully qualified domain names for the target service. A domain name may have a wildcard prefix.
ServiceEndpoints []string `json:"service_endpoints" validate:"required"`
// The target for this endpoint gateway.
Target EndpointGatewayTargetIntf `json:"target" validate:"required"`
// The VPC this endpoint gateway resides in.
VPC *VPCReference `json:"vpc" validate:"required"`
}
// Constants associated with the EndpointGateway.HealthState property.
// The health of this resource:
// - `ok`: No abnormal behavior detected
// - `degraded`: Experiencing 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 (
EndpointGatewayLifecycleStateDeletingConst = "deleting"
EndpointGatewayLifecycleStateFailedConst = "failed"
EndpointGatewayLifecycleStatePendingConst = "pending"
EndpointGatewayLifecycleStateStableConst = "stable"
EndpointGatewayLifecycleStateSuspendedConst = "suspended"
EndpointGatewayLifecycleStateUpdatingConst = "updating"
EndpointGatewayLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the EndpointGateway.ResourceType property.
// The resource type.
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, "allow_dns_resolution_binding", &obj.AllowDnsResolutionBinding)
if err != nil {
err = core.SDKErrorf(err, "", "allow_dns_resolution_binding-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState)
if err != nil {
err = core.SDKErrorf(err, "", "health_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "ips-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalEndpointGatewayLifecycleReason)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "service_endpoint", &obj.ServiceEndpoint)
if err != nil {
err = core.SDKErrorf(err, "", "service_endpoint-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "service_endpoints", &obj.ServiceEndpoints)
if err != nil {
err = core.SDKErrorf(err, "", "service_endpoints-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalEndpointGatewayTarget)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// EndpointGatewayCollection : EndpointGatewayCollection struct
type EndpointGatewayCollection struct {
// A page of endpoint gateways.
EndpointGateways []EndpointGateway `json:"endpoint_gateways" validate:"required"`
// A link to the first page of resources.
First *PageLink `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 *PageLink `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 {
err = core.SDKErrorf(err, "", "endpoint_gateways-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *EndpointGatewayCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// EndpointGatewayLifecycleReason : EndpointGatewayLifecycleReason struct
type EndpointGatewayLifecycleReason struct {
// A reason code for this lifecycle state:
// - `access_denied`: endpoint gateway access was denied
// - `access_expired`: endpoint gateway access has expired
// - `access_pending`: endpoint gateway access is pending
// - `dns_resolution_binding_pending`: the DNS resolution binding is being set up
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this lifecycle state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this lifecycle state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the EndpointGatewayLifecycleReason.Code property.
// A reason code for this lifecycle state:
// - `access_denied`: endpoint gateway access was denied
// - `access_expired`: endpoint gateway access has expired
// - `access_pending`: endpoint gateway access is pending
// - `dns_resolution_binding_pending`: the DNS resolution binding is being set up
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
EndpointGatewayLifecycleReasonCodeAccessDeniedConst = "access_denied"
EndpointGatewayLifecycleReasonCodeAccessExpiredConst = "access_expired"
EndpointGatewayLifecycleReasonCodeAccessPendingConst = "access_pending"
EndpointGatewayLifecycleReasonCodeDnsResolutionBindingPendingConst = "dns_resolution_binding_pending"
EndpointGatewayLifecycleReasonCodeInternalErrorConst = "internal_error"
EndpointGatewayLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider"
)
// UnmarshalEndpointGatewayLifecycleReason unmarshals an instance of EndpointGatewayLifecycleReason from the specified map of raw messages.
func UnmarshalEndpointGatewayLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(EndpointGatewayLifecycleReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// EndpointGatewayPatch : EndpointGatewayPatch struct
type EndpointGatewayPatch struct {
// Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in
// has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`.
//
// If `true`, then there must not be another endpoint gateway with
// `allow_dns_resolution_binding` set to `true` in the [DNS sharing](/docs/vpc?topic=vpc-vpe-dns-sharing) connected
// topology that:
// - Has the same `target` as this endpoint gateway
// - Has `service_endpoints` that overlap with the `service_endpoints` for this endpoint
// gateway.
//
// Must be `true` if the VPC this endpoint gateway resides in has `dns.enable_hub` set to
// `true`.
AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"`
// The name for this endpoint gateway. The name must not be used by another endpoint gateway in the VPC.
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, "allow_dns_resolution_binding", &obj.AllowDnsResolutionBinding)
if err != nil {
err = core.SDKErrorf(err, "", "allow_dns_resolution_binding-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(endpointGatewayPatch.AllowDnsResolutionBinding) {
_patch["allow_dns_resolution_binding"] = endpointGatewayPatch.AllowDnsResolutionBinding
}
if !core.IsNil(endpointGatewayPatch.Name) {
_patch["name"] = endpointGatewayPatch.Name
}
return
}
// EndpointGatewayReferenceRemote : EndpointGatewayReferenceRemote struct
type EndpointGatewayReferenceRemote struct {
// The CRN for this endpoint gateway.
CRN *string `json:"crn" 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"`
// The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC.
Name *string `json:"name" validate:"required"`
// If present, this property indicates that the resource associated with this reference
// is remote and therefore may not be directly retrievable.
Remote *EndpointGatewayRemote `json:"remote,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the EndpointGatewayReferenceRemote.ResourceType property.
// The resource type.
const (
EndpointGatewayReferenceRemoteResourceTypeEndpointGatewayConst = "endpoint_gateway"
)
// UnmarshalEndpointGatewayReferenceRemote unmarshals an instance of EndpointGatewayReferenceRemote from the specified map of raw messages.
func UnmarshalEndpointGatewayReferenceRemote(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(EndpointGatewayReferenceRemote)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalEndpointGatewayRemote)
if err != nil {
err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// EndpointGatewayRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not
// be directly retrievable.
type EndpointGatewayRemote struct {
// If present, this property indicates that the referenced resource is remote to this
// account, and identifies the owning account.
Account *AccountReference `json:"account,omitempty"`
// If present, this property indicates that the referenced resource is remote to this
// region, and identifies the native region.
Region *RegionReference `json:"region,omitempty"`
}
// UnmarshalEndpointGatewayRemote unmarshals an instance of EndpointGatewayRemote from the specified map of raw messages.
func UnmarshalEndpointGatewayRemote(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(EndpointGatewayRemote)
err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference)
if err != nil {
err = core.SDKErrorf(err, "", "account-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference)
if err != nil {
err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// EndpointGatewayReservedIP : A reserved IP to bind to the endpoint gateway. This can be specified using an existing reserved IP, or a prototype
// object for a new 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"`
// The IP address to reserve, which must not already be reserved on the subnet.
//
// If unspecified, an available address on the subnet will automatically be selected.
Address *string `json:"address,omitempty"`
// Indicates whether this reserved IP member will be automatically deleted when either
// `target` is deleted, or the reserved IP is unbound.
AutoDelete *bool `json:"auto_delete,omitempty"`
// The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with
// `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated
// list of randomly-selected words.
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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// EndpointGatewayTarget : The target for this endpoint gateway.
// Models which "extend" this model:
// - EndpointGatewayTargetPrivatePathServiceGatewayReference
// - EndpointGatewayTargetProviderCloudServiceReference
// - EndpointGatewayTargetProviderInfrastructureServiceReference
type EndpointGatewayTarget struct {
// The target resource type for this endpoint gateway.
ResourceType *string `json:"resource_type" validate:"required"`
// The CRN for this private path service gateway.
CRN *string `json:"crn,omitempty"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this private path service gateway.
Href *string `json:"href,omitempty"`
// The unique identifier for this private path service gateway.
ID *string `json:"id,omitempty"`
// The name for this private path service gateway. The name is unique across all private path service gateways in the
// VPC.
Name *string `json:"name,omitempty"`
// If present, this property indicates that the resource associated with this reference
// is remote and therefore may not be directly retrievable.
Remote *PrivatePathServiceGatewayRemote `json:"remote,omitempty"`
}
// Constants associated with the EndpointGatewayTarget.ResourceType property.
// The target resource type for this endpoint gateway.
const (
EndpointGatewayTargetResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway"
EndpointGatewayTargetResourceTypeProviderCloudServiceConst = "provider_cloud_service"
EndpointGatewayTargetResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_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, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalPrivatePathServiceGatewayRemote)
if err != nil {
err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// EndpointGatewayTargetPrototype : The target to use for this endpoint gateway. The target:
// - Must not already be the target of another endpoint gateway in the VPC
// - Must not have a service endpoint that overlaps with any `service_endpoints` of
// another endpoint gateway in the VPC.
//
// If `allow_dns_resolution_binding` is `true`, then there must not be another endpoint gateway with
// `allow_dns_resolution_binding` set to `true` in the [DNS sharing](/docs/vpc?topic=vpc-vpe-dns-sharing) connected
// topology that:
// - Has the same `target` as this endpoint gateway
// - Has `service_endpoints` that overlap with the `service_endpoints` for this endpoint
// gateway.
//
// Models which "extend" this model:
// - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype
// - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype
// - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype
type EndpointGatewayTargetPrototype struct {
// The target resource type for this endpoint gateway.
ResourceType *string `json:"resource_type,omitempty"`
// The CRN for this private path service gateway.
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 target resource type for this endpoint gateway.
const (
EndpointGatewayTargetPrototypeResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway"
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) {
obj := new(EndpointGatewayTargetPrototype)
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// FailoverShareOptions : The FailoverShare options.
type FailoverShareOptions struct {
// The file share identifier.
ShareID *string `json:"share_id" validate:"required,ne="`
// The action to take if the failover request is accepted but cannot be performed or times out:
// - `fail`: Fail the operation, resulting in the replication relationship being unchanged.
// - `split`: Split the replica from its source, resulting in two individual read-write
// file shares. Because the final sync was not completed, the replica may be
// out-of-date. This occurs in disaster recovery scenarios where the source is known to
// be unreachable.
FallbackPolicy *string `json:"fallback_policy,omitempty"`
// The failover timeout in seconds.
//
// If the timeout is reached, the `fallback_policy` will be triggered.
Timeout *int64 `json:"timeout,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the FailoverShareOptions.FallbackPolicy property.
// The action to take if the failover request is accepted but cannot be performed or times out:
// - `fail`: Fail the operation, resulting in the replication relationship being unchanged.
// - `split`: Split the replica from its source, resulting in two individual read-write
// file shares. Because the final sync was not completed, the replica may be
// out-of-date. This occurs in disaster recovery scenarios where the source is known to
// be unreachable.
const (
FailoverShareOptionsFallbackPolicyFailConst = "fail"
FailoverShareOptionsFallbackPolicySplitConst = "split"
)
// NewFailoverShareOptions : Instantiate FailoverShareOptions
func (*VpcV1) NewFailoverShareOptions(shareID string) *FailoverShareOptions {
return &FailoverShareOptions{
ShareID: core.StringPtr(shareID),
}
}
// SetShareID : Allow user to set ShareID
func (_options *FailoverShareOptions) SetShareID(shareID string) *FailoverShareOptions {
_options.ShareID = core.StringPtr(shareID)
return _options
}
// SetFallbackPolicy : Allow user to set FallbackPolicy
func (_options *FailoverShareOptions) SetFallbackPolicy(fallbackPolicy string) *FailoverShareOptions {
_options.FallbackPolicy = core.StringPtr(fallbackPolicy)
return _options
}
// SetTimeout : Allow user to set Timeout
func (_options *FailoverShareOptions) SetTimeout(timeout int64) *FailoverShareOptions {
_options.Timeout = core.Int64Ptr(timeout)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *FailoverShareOptions) SetHeaders(param map[string]string) *FailoverShareOptions {
options.Headers = param
return options
}
// 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 name for this floating IP. The name is unique across all floating IPs in the region.
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.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTarget)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
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 *PageLink `json:"first" validate:"required"`
// A page 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 *PageLink `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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIP)
if err != nil {
err = core.SDKErrorf(err, "", "floating_ips-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *FloatingIPCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// FloatingIPCollectionVirtualNetworkInterfaceContext : FloatingIPCollectionVirtualNetworkInterfaceContext struct
type FloatingIPCollectionVirtualNetworkInterfaceContext struct {
// A link to the first page of resources.
First *PageLink `json:"first" validate:"required"`
// A page of floating IPs bound to the virtual network interface specified by the identifier in the URL.
FloatingIps []FloatingIPReference `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext unmarshals an instance of FloatingIPCollectionVirtualNetworkInterfaceContext from the specified map of raw messages.
func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(FloatingIPCollectionVirtualNetworkInterfaceContext)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "floating_ips-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *FloatingIPCollectionVirtualNetworkInterfaceContext) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// FloatingIPPatch : FloatingIPPatch struct
type FloatingIPPatch struct {
// The name for this floating IP. The name must not be used by another floating IP in the region.
Name *string `json:"name,omitempty"`
// The target resource to bind this floating IP to, replacing any existing binding.
// The floating IP must not be required by another resource, such as a public gateway.
//
// The target resource must not already have a floating IP bound to it if the target
// resource is:
//
// - an instance network interface
// - a bare metal server network interface with `enable_infrastructure_nat` set to `true`
// - a virtual network interface with `enable_infrastructure_nat` set to `true`
//
// Specify `null` to remove an existing binding.
Target FloatingIPTargetPatchIntf `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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPatch)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(floatingIPPatch.Name) {
_patch["name"] = floatingIPPatch.Name
}
if !core.IsNil(floatingIPPatch.Target) {
_patch["target"] = floatingIPPatch.Target.asPatch()
}
return
}
// FloatingIPPrototype : FloatingIPPrototype struct
// Models which "extend" this model:
// - FloatingIPPrototypeFloatingIPByZone
// - FloatingIPPrototypeFloatingIPByTarget
type FloatingIPPrototype struct {
// The name for this floating IP. The name must not be used by another floating IP in the region. 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The zone this floating IP will reside in.
Zone ZoneIdentityIntf `json:"zone,omitempty"`
// The target resource to bind this floating IP to.
//
// The target resource must not already have a floating IP bound to it if the target
// resource is:
//
// - an instance network interface
// - a bare metal server network interface with `enable_infrastructure_nat` set to `true`
// - a virtual network interface with `enable_infrastructure_nat` set to `true`.
Target FloatingIPTargetPrototypeIntf `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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
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 *Deleted `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 name for this floating IP. The name is unique across all floating IPs in the region.
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 {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// FloatingIPTarget : The target of this floating IP.
// Models which "extend" this model:
// - FloatingIPTargetNetworkInterfaceReference
// - FloatingIPTargetBareMetalServerNetworkInterfaceReference
// - FloatingIPTargetPublicGatewayReference
// - FloatingIPTargetVirtualNetworkInterfaceReference
type FloatingIPTarget struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this instance network interface.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment.
Href *string `json:"href,omitempty"`
// The unique identifier for this instance network interface.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the identifier is that of the
// corresponding network attachment.
ID *string `json:"id,omitempty"`
// The name for this instance network interface.
Name *string `json:"name,omitempty"`
// The primary IP address of this instance network interface.
PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type,omitempty"`
// The CRN for this public gateway.
CRN *string `json:"crn,omitempty"`
// The associated subnet.
Subnet *SubnetReference `json:"subnet,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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// FloatingIPTargetPatch : The target resource to bind this floating IP to, replacing any existing binding. The floating IP must not be required
// by another resource, such as a public gateway.
//
// The target resource must not already have a floating IP bound to it if the target resource is:
//
// - an instance network interface
// - a bare metal server network interface with `enable_infrastructure_nat` set to `true`
// - a virtual network interface with `enable_infrastructure_nat` set to `true`
//
// Specify `null` to remove an existing binding.
// Models which "extend" this model:
// - FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity
// - FloatingIPTargetPatchNetworkInterfaceIdentity
// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentity
type FloatingIPTargetPatch struct {
// The unique identifier for this bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the identifier is that of the
// corresponding network attachment.
ID *string `json:"id,omitempty"`
// The URL for this bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment.
Href *string `json:"href,omitempty"`
// The CRN for this virtual network interface.
CRN *string `json:"crn,omitempty"`
}
func (*FloatingIPTargetPatch) isaFloatingIPTargetPatch() bool {
return true
}
type FloatingIPTargetPatchIntf interface {
isaFloatingIPTargetPatch() bool
asPatch() map[string]interface{}
}
// UnmarshalFloatingIPTargetPatch unmarshals an instance of FloatingIPTargetPatch from the specified map of raw messages.
func UnmarshalFloatingIPTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(FloatingIPTargetPatch)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the FloatingIPTargetPatch
func (floatingIPTargetPatch *FloatingIPTargetPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(floatingIPTargetPatch.ID) {
_patch["id"] = floatingIPTargetPatch.ID
}
if !core.IsNil(floatingIPTargetPatch.Href) {
_patch["href"] = floatingIPTargetPatch.Href
}
if !core.IsNil(floatingIPTargetPatch.CRN) {
_patch["crn"] = floatingIPTargetPatch.CRN
}
return
}
// FloatingIPTargetPrototype : The target resource to bind this floating IP to.
//
// The target resource must not already have a floating IP bound to it if the target resource is:
//
// - an instance network interface
// - a bare metal server network interface with `enable_infrastructure_nat` set to `true`
// - a virtual network interface with `enable_infrastructure_nat` set to `true`.
// Models which "extend" this model:
// - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity
// - FloatingIPTargetPrototypeNetworkInterfaceIdentity
// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity
type FloatingIPTargetPrototype struct {
// The unique identifier for this bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the identifier is that of the
// corresponding network attachment.
ID *string `json:"id,omitempty"`
// The URL for this bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment.
Href *string `json:"href,omitempty"`
// The CRN for this virtual network interface.
CRN *string `json:"crn,omitempty"`
}
func (*FloatingIPTargetPrototype) isaFloatingIPTargetPrototype() bool {
return true
}
type FloatingIPTargetPrototypeIntf interface {
isaFloatingIPTargetPrototype() bool
}
// UnmarshalFloatingIPTargetPrototype unmarshals an instance of FloatingIPTargetPrototype from the specified map of raw messages.
func UnmarshalFloatingIPTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(FloatingIPTargetPrototype)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// FloatingIPUnpaginatedCollection : FloatingIPUnpaginatedCollection struct
type FloatingIPUnpaginatedCollection struct {
// The 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 {
err = core.SDKErrorf(err, "", "floating_ips-error", common.GetComponentInfo())
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"`
// Indicates whether this flow log collector will be automatically deleted when `target` is deleted. At present, this
// is always `true`, but may be modifiable in the future.
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 name for this flow log collector. The name is unique across all flow log collectors in the VPC.
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. For more
// information, see [Viewing flow log
// objects](https://cloud.ibm.com/docs/vpc?topic=vpc-fl-analyze).
StorageBucket *LegacyCloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"`
// The target this collector is collecting flow logs for.
//
// - If the target is an instance network attachment, flow logs will be collected
// for that instance network attachment.
// - If the target is an instance network interface, flow logs will be collected
// for that instance network interface.
// - If the target is a virtual network interface, flow logs will be collected for the
// virtual network interface's `target` resource if the resource is an instance network
// attachment, unless the target resource is itself the target of a flow log collector.
// - If the target is a virtual server instance, flow logs will be collected
// for all network attachments or network interfaces on that instance.
// - If the target is a subnet, flow logs will be collected
// for all instance network interfaces and virtual network interfaces
// attached to that subnet.
// - If the target is a VPC, flow logs will be collected for all instance network
// interfaces and virtual network interfaces attached to all subnets within that VPC.
//
// If the target is an instance, subnet, or VPC, flow logs will not be collected
// for any instance network attachments or instance 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 resides in.
VPC *VPCReference `json:"vpc" validate:"required"`
}
// Constants associated with the FlowLogCollector.LifecycleState property.
// The lifecycle state of the flow log collector.
const (
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 {
err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "storage_bucket", &obj.StorageBucket, UnmarshalLegacyCloudObjectStorageBucketReference)
if err != nil {
err = core.SDKErrorf(err, "", "storage_bucket-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFlowLogCollectorTarget)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
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 *PageLink `json:"first" validate:"required"`
// A page 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 *PageLink `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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "flow_log_collectors", &obj.FlowLogCollectors, UnmarshalFlowLogCollector)
if err != nil {
err = core.SDKErrorf(err, "", "flow_log_collectors-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *FlowLogCollectorCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// 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 name for this flow log collector. The name must not be used by another flow log collector in the VPC.
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 {
err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(flowLogCollectorPatch.Active) {
_patch["active"] = flowLogCollectorPatch.Active
}
if !core.IsNil(flowLogCollectorPatch.Name) {
_patch["name"] = flowLogCollectorPatch.Name
}
return
}
// FlowLogCollectorTarget : The target this collector is collecting flow logs for.
//
// - If the target is an instance network attachment, flow logs will be collected
// for that instance network attachment.
// - If the target is an instance network interface, flow logs will be collected
// for that instance network interface.
// - If the target is a virtual network interface, flow logs will be collected for the
// virtual network interface's `target` resource if the resource is an instance network
// attachment, unless the target resource is itself the target of a flow log collector.
// - If the target is a virtual server instance, flow logs will be collected
// for all network attachments or network interfaces on that instance.
// - If the target is a subnet, flow logs will be collected
// for all instance network interfaces and virtual network interfaces
// attached to that subnet.
// - If the target is a VPC, flow logs will be collected for all instance network
// interfaces and virtual network interfaces attached to all subnets within that VPC.
//
// If the target is an instance, subnet, or VPC, flow logs will not be collected for any instance network attachments or
// instance 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
// - FlowLogCollectorTargetInstanceNetworkAttachmentReference
// - FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext
type FlowLogCollectorTarget struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this instance network interface.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment.
Href *string `json:"href,omitempty"`
// The unique identifier for this instance network interface.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the identifier is that of the
// corresponding network attachment.
ID *string `json:"id,omitempty"`
// The name for this instance 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"`
// The primary IP address of the virtual network interface for the instance network
// attachment.
PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"`
// The subnet of the virtual network interface for the instance network attachment.
Subnet *SubnetReference `json:"subnet,omitempty"`
// The virtual network interface for this instance network attachment.
VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface,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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext)
if err != nil {
err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo())
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 instance network attachments,
// virtual network interfaces or instance network interfaces within the target that are themselves the target of a more
// specific flow log collector.
//
// The target must not be a virtual network interface that is attached to a bare metal server network attachment or to a
// file share mount target.
// Models which "extend" this model:
// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity
// - FlowLogCollectorTargetPrototypeInstanceIdentity
// - FlowLogCollectorTargetPrototypeSubnetIdentity
// - FlowLogCollectorTargetPrototypeVPCIdentity
// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity
// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity
type FlowLogCollectorTargetPrototype struct {
// The unique identifier for this instance network interface.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the identifier is that of the
// corresponding network attachment.
ID *string `json:"id,omitempty"`
// The URL for this instance network interface.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment.
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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// GetBackupPolicyJobOptions : The GetBackupPolicyJob options.
type GetBackupPolicyJobOptions struct {
// The backup policy identifier.
BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="`
// The backup policy job identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetBackupPolicyJobOptions : Instantiate GetBackupPolicyJobOptions
func (*VpcV1) NewGetBackupPolicyJobOptions(backupPolicyID string, id string) *GetBackupPolicyJobOptions {
return &GetBackupPolicyJobOptions{
BackupPolicyID: core.StringPtr(backupPolicyID),
ID: core.StringPtr(id),
}
}
// SetBackupPolicyID : Allow user to set BackupPolicyID
func (_options *GetBackupPolicyJobOptions) SetBackupPolicyID(backupPolicyID string) *GetBackupPolicyJobOptions {
_options.BackupPolicyID = core.StringPtr(backupPolicyID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetBackupPolicyJobOptions) SetID(id string) *GetBackupPolicyJobOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetBackupPolicyJobOptions) SetHeaders(param map[string]string) *GetBackupPolicyJobOptions {
options.Headers = param
return options
}
// GetBackupPolicyOptions : The GetBackupPolicy options.
type GetBackupPolicyOptions struct {
// The backup policy identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetBackupPolicyOptions : Instantiate GetBackupPolicyOptions
func (*VpcV1) NewGetBackupPolicyOptions(id string) *GetBackupPolicyOptions {
return &GetBackupPolicyOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *GetBackupPolicyOptions) SetID(id string) *GetBackupPolicyOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetBackupPolicyOptions) SetHeaders(param map[string]string) *GetBackupPolicyOptions {
options.Headers = param
return options
}
// GetBackupPolicyPlanOptions : The GetBackupPolicyPlan options.
type GetBackupPolicyPlanOptions struct {
// The backup policy identifier.
BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="`
// The backup policy plan identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetBackupPolicyPlanOptions : Instantiate GetBackupPolicyPlanOptions
func (*VpcV1) NewGetBackupPolicyPlanOptions(backupPolicyID string, id string) *GetBackupPolicyPlanOptions {
return &GetBackupPolicyPlanOptions{
BackupPolicyID: core.StringPtr(backupPolicyID),
ID: core.StringPtr(id),
}
}
// SetBackupPolicyID : Allow user to set BackupPolicyID
func (_options *GetBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *GetBackupPolicyPlanOptions {
_options.BackupPolicyID = core.StringPtr(backupPolicyID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetBackupPolicyPlanOptions) SetID(id string) *GetBackupPolicyPlanOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetBackupPolicyPlanOptions) SetHeaders(param map[string]string) *GetBackupPolicyPlanOptions {
options.Headers = param
return options
}
// GetBareMetalServerDiskOptions : The GetBareMetalServerDisk options.
type GetBareMetalServerDiskOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// The bare metal server disk identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetBareMetalServerDiskOptions : Instantiate GetBareMetalServerDiskOptions
func (*VpcV1) NewGetBareMetalServerDiskOptions(bareMetalServerID string, id string) *GetBareMetalServerDiskOptions {
return &GetBareMetalServerDiskOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
ID: core.StringPtr(id),
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *GetBareMetalServerDiskOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerDiskOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetBareMetalServerDiskOptions) SetID(id string) *GetBareMetalServerDiskOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetBareMetalServerDiskOptions) SetHeaders(param map[string]string) *GetBareMetalServerDiskOptions {
options.Headers = param
return options
}
// GetBareMetalServerInitializationOptions : The GetBareMetalServerInitialization options.
type GetBareMetalServerInitializationOptions struct {
// The bare metal server identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetBareMetalServerInitializationOptions : Instantiate GetBareMetalServerInitializationOptions
func (*VpcV1) NewGetBareMetalServerInitializationOptions(id string) *GetBareMetalServerInitializationOptions {
return &GetBareMetalServerInitializationOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *GetBareMetalServerInitializationOptions) SetID(id string) *GetBareMetalServerInitializationOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetBareMetalServerInitializationOptions) SetHeaders(param map[string]string) *GetBareMetalServerInitializationOptions {
options.Headers = param
return options
}
// GetBareMetalServerNetworkAttachmentOptions : The GetBareMetalServerNetworkAttachment options.
type GetBareMetalServerNetworkAttachmentOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// The bare metal server network attachment identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetBareMetalServerNetworkAttachmentOptions : Instantiate GetBareMetalServerNetworkAttachmentOptions
func (*VpcV1) NewGetBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string) *GetBareMetalServerNetworkAttachmentOptions {
return &GetBareMetalServerNetworkAttachmentOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
ID: core.StringPtr(id),
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *GetBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkAttachmentOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetBareMetalServerNetworkAttachmentOptions) SetID(id string) *GetBareMetalServerNetworkAttachmentOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkAttachmentOptions {
options.Headers = param
return options
}
// GetBareMetalServerNetworkInterfaceFloatingIPOptions : The GetBareMetalServerNetworkInterfaceFloatingIP options.
type GetBareMetalServerNetworkInterfaceFloatingIPOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// The bare metal server network interface identifier.
NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="`
// The floating IP identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate GetBareMetalServerNetworkInterfaceFloatingIPOptions
func (*VpcV1) NewGetBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions {
return &GetBareMetalServerNetworkInterfaceFloatingIPOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
NetworkInterfaceID: core.StringPtr(networkInterfaceID),
ID: core.StringPtr(id),
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID
func (_options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions {
_options.NetworkInterfaceID = core.StringPtr(networkInterfaceID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions {
options.Headers = param
return options
}
// GetBareMetalServerNetworkInterfaceIPOptions : The GetBareMetalServerNetworkInterfaceIP options.
type GetBareMetalServerNetworkInterfaceIPOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// The bare metal server network interface identifier.
NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="`
// The reserved IP identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetBareMetalServerNetworkInterfaceIPOptions : Instantiate GetBareMetalServerNetworkInterfaceIPOptions
func (*VpcV1) NewGetBareMetalServerNetworkInterfaceIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *GetBareMetalServerNetworkInterfaceIPOptions {
return &GetBareMetalServerNetworkInterfaceIPOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
NetworkInterfaceID: core.StringPtr(networkInterfaceID),
ID: core.StringPtr(id),
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkInterfaceIPOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID
func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetBareMetalServerNetworkInterfaceIPOptions {
_options.NetworkInterfaceID = core.StringPtr(networkInterfaceID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetID(id string) *GetBareMetalServerNetworkInterfaceIPOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetBareMetalServerNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkInterfaceIPOptions {
options.Headers = param
return options
}
// GetBareMetalServerNetworkInterfaceOptions : The GetBareMetalServerNetworkInterface options.
type GetBareMetalServerNetworkInterfaceOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// The bare metal server network interface identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetBareMetalServerNetworkInterfaceOptions : Instantiate GetBareMetalServerNetworkInterfaceOptions
func (*VpcV1) NewGetBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string) *GetBareMetalServerNetworkInterfaceOptions {
return &GetBareMetalServerNetworkInterfaceOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
ID: core.StringPtr(id),
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *GetBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkInterfaceOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetBareMetalServerNetworkInterfaceOptions) SetID(id string) *GetBareMetalServerNetworkInterfaceOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkInterfaceOptions {
options.Headers = param
return options
}
// GetBareMetalServerOptions : The GetBareMetalServer options.
type GetBareMetalServerOptions struct {
// The bare metal server identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetBareMetalServerOptions : Instantiate GetBareMetalServerOptions
func (*VpcV1) NewGetBareMetalServerOptions(id string) *GetBareMetalServerOptions {
return &GetBareMetalServerOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *GetBareMetalServerOptions) SetID(id string) *GetBareMetalServerOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetBareMetalServerOptions) SetHeaders(param map[string]string) *GetBareMetalServerOptions {
options.Headers = param
return options
}
// GetBareMetalServerProfileOptions : The GetBareMetalServerProfile options.
type GetBareMetalServerProfileOptions struct {
// The bare metal server profile name.
Name *string `json:"name" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetBareMetalServerProfileOptions : Instantiate GetBareMetalServerProfileOptions
func (*VpcV1) NewGetBareMetalServerProfileOptions(name string) *GetBareMetalServerProfileOptions {
return &GetBareMetalServerProfileOptions{
Name: core.StringPtr(name),
}
}
// SetName : Allow user to set Name
func (_options *GetBareMetalServerProfileOptions) SetName(name string) *GetBareMetalServerProfileOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetBareMetalServerProfileOptions) SetHeaders(param map[string]string) *GetBareMetalServerProfileOptions {
options.Headers = param
return options
}
// GetClusterNetworkInterfaceOptions : The GetClusterNetworkInterface options.
type GetClusterNetworkInterfaceOptions struct {
// The cluster network identifier.
ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="`
// The cluster network interface identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetClusterNetworkInterfaceOptions : Instantiate GetClusterNetworkInterfaceOptions
func (*VpcV1) NewGetClusterNetworkInterfaceOptions(clusterNetworkID string, id string) *GetClusterNetworkInterfaceOptions {
return &GetClusterNetworkInterfaceOptions{
ClusterNetworkID: core.StringPtr(clusterNetworkID),
ID: core.StringPtr(id),
}
}
// SetClusterNetworkID : Allow user to set ClusterNetworkID
func (_options *GetClusterNetworkInterfaceOptions) SetClusterNetworkID(clusterNetworkID string) *GetClusterNetworkInterfaceOptions {
_options.ClusterNetworkID = core.StringPtr(clusterNetworkID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetClusterNetworkInterfaceOptions) SetID(id string) *GetClusterNetworkInterfaceOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetClusterNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetClusterNetworkInterfaceOptions {
options.Headers = param
return options
}
// GetClusterNetworkOptions : The GetClusterNetwork options.
type GetClusterNetworkOptions struct {
// The cluster network identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetClusterNetworkOptions : Instantiate GetClusterNetworkOptions
func (*VpcV1) NewGetClusterNetworkOptions(id string) *GetClusterNetworkOptions {
return &GetClusterNetworkOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *GetClusterNetworkOptions) SetID(id string) *GetClusterNetworkOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetClusterNetworkOptions) SetHeaders(param map[string]string) *GetClusterNetworkOptions {
options.Headers = param
return options
}
// GetClusterNetworkProfileOptions : The GetClusterNetworkProfile options.
type GetClusterNetworkProfileOptions struct {
// The cluster network profile name.
Name *string `json:"name" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetClusterNetworkProfileOptions : Instantiate GetClusterNetworkProfileOptions
func (*VpcV1) NewGetClusterNetworkProfileOptions(name string) *GetClusterNetworkProfileOptions {
return &GetClusterNetworkProfileOptions{
Name: core.StringPtr(name),
}
}
// SetName : Allow user to set Name
func (_options *GetClusterNetworkProfileOptions) SetName(name string) *GetClusterNetworkProfileOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetClusterNetworkProfileOptions) SetHeaders(param map[string]string) *GetClusterNetworkProfileOptions {
options.Headers = param
return options
}
// GetClusterNetworkSubnetOptions : The GetClusterNetworkSubnet options.
type GetClusterNetworkSubnetOptions struct {
// The cluster network identifier.
ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="`
// The cluster network subnet identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetClusterNetworkSubnetOptions : Instantiate GetClusterNetworkSubnetOptions
func (*VpcV1) NewGetClusterNetworkSubnetOptions(clusterNetworkID string, id string) *GetClusterNetworkSubnetOptions {
return &GetClusterNetworkSubnetOptions{
ClusterNetworkID: core.StringPtr(clusterNetworkID),
ID: core.StringPtr(id),
}
}
// SetClusterNetworkID : Allow user to set ClusterNetworkID
func (_options *GetClusterNetworkSubnetOptions) SetClusterNetworkID(clusterNetworkID string) *GetClusterNetworkSubnetOptions {
_options.ClusterNetworkID = core.StringPtr(clusterNetworkID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetClusterNetworkSubnetOptions) SetID(id string) *GetClusterNetworkSubnetOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetClusterNetworkSubnetOptions) SetHeaders(param map[string]string) *GetClusterNetworkSubnetOptions {
options.Headers = param
return options
}
// GetClusterNetworkSubnetReservedIPOptions : The GetClusterNetworkSubnetReservedIP options.
type GetClusterNetworkSubnetReservedIPOptions struct {
// The cluster network identifier.
ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="`
// The cluster network subnet identifier.
ClusterNetworkSubnetID *string `json:"cluster_network_subnet_id" validate:"required,ne="`
// The cluster network subnet reserved IP identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetClusterNetworkSubnetReservedIPOptions : Instantiate GetClusterNetworkSubnetReservedIPOptions
func (*VpcV1) NewGetClusterNetworkSubnetReservedIPOptions(clusterNetworkID string, clusterNetworkSubnetID string, id string) *GetClusterNetworkSubnetReservedIPOptions {
return &GetClusterNetworkSubnetReservedIPOptions{
ClusterNetworkID: core.StringPtr(clusterNetworkID),
ClusterNetworkSubnetID: core.StringPtr(clusterNetworkSubnetID),
ID: core.StringPtr(id),
}
}
// SetClusterNetworkID : Allow user to set ClusterNetworkID
func (_options *GetClusterNetworkSubnetReservedIPOptions) SetClusterNetworkID(clusterNetworkID string) *GetClusterNetworkSubnetReservedIPOptions {
_options.ClusterNetworkID = core.StringPtr(clusterNetworkID)
return _options
}
// SetClusterNetworkSubnetID : Allow user to set ClusterNetworkSubnetID
func (_options *GetClusterNetworkSubnetReservedIPOptions) SetClusterNetworkSubnetID(clusterNetworkSubnetID string) *GetClusterNetworkSubnetReservedIPOptions {
_options.ClusterNetworkSubnetID = core.StringPtr(clusterNetworkSubnetID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetClusterNetworkSubnetReservedIPOptions) SetID(id string) *GetClusterNetworkSubnetReservedIPOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetClusterNetworkSubnetReservedIPOptions) SetHeaders(param map[string]string) *GetClusterNetworkSubnetReservedIPOptions {
options.Headers = param
return options
}
// GetDedicatedHostDiskOptions : The GetDedicatedHostDisk options.
type GetDedicatedHostDiskOptions struct {
// The dedicated host identifier.
DedicatedHostID *string `json:"dedicated_host_id" validate:"required,ne="`
// The dedicated host disk identifier.
ID *string `json:"id" 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 `json:"id" 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 `json:"id" 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 `json:"name" 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 `json:"endpoint_gateway_id" validate:"required,ne="`
// The reserved IP identifier.
ID *string `json:"id" 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 `json:"id" 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 `json:"id" 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 `json:"id" 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 `json:"id" 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
}
// GetImageExportJobOptions : The GetImageExportJob options.
type GetImageExportJobOptions struct {
// The image identifier.
ImageID *string `json:"image_id" validate:"required,ne="`
// The image export job identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetImageExportJobOptions : Instantiate GetImageExportJobOptions
func (*VpcV1) NewGetImageExportJobOptions(imageID string, id string) *GetImageExportJobOptions {
return &GetImageExportJobOptions{
ImageID: core.StringPtr(imageID),
ID: core.StringPtr(id),
}
}
// SetImageID : Allow user to set ImageID
func (_options *GetImageExportJobOptions) SetImageID(imageID string) *GetImageExportJobOptions {
_options.ImageID = core.StringPtr(imageID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetImageExportJobOptions) SetID(id string) *GetImageExportJobOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetImageExportJobOptions) SetHeaders(param map[string]string) *GetImageExportJobOptions {
options.Headers = param
return options
}
// GetImageOptions : The GetImage options.
type GetImageOptions struct {
// The image identifier.
ID *string `json:"id" 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
}
// GetInstanceClusterNetworkAttachmentOptions : The GetInstanceClusterNetworkAttachment options.
type GetInstanceClusterNetworkAttachmentOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance cluster network attachment identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetInstanceClusterNetworkAttachmentOptions : Instantiate GetInstanceClusterNetworkAttachmentOptions
func (*VpcV1) NewGetInstanceClusterNetworkAttachmentOptions(instanceID string, id string) *GetInstanceClusterNetworkAttachmentOptions {
return &GetInstanceClusterNetworkAttachmentOptions{
InstanceID: core.StringPtr(instanceID),
ID: core.StringPtr(id),
}
}
// SetInstanceID : Allow user to set InstanceID
func (_options *GetInstanceClusterNetworkAttachmentOptions) SetInstanceID(instanceID string) *GetInstanceClusterNetworkAttachmentOptions {
_options.InstanceID = core.StringPtr(instanceID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetInstanceClusterNetworkAttachmentOptions) SetID(id string) *GetInstanceClusterNetworkAttachmentOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetInstanceClusterNetworkAttachmentOptions) SetHeaders(param map[string]string) *GetInstanceClusterNetworkAttachmentOptions {
options.Headers = param
return options
}
// GetInstanceDiskOptions : The GetInstanceDisk options.
type GetInstanceDiskOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance disk identifier.
ID *string `json:"id" 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
}
// GetInstanceGroupManagerActionOptions : The GetInstanceGroupManagerAction options.
type GetInstanceGroupManagerActionOptions struct {
// The instance group identifier.
InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="`
// The instance group manager identifier.
InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="`
// The instance group manager action identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetInstanceGroupManagerActionOptions : Instantiate GetInstanceGroupManagerActionOptions
func (*VpcV1) NewGetInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string) *GetInstanceGroupManagerActionOptions {
return &GetInstanceGroupManagerActionOptions{
InstanceGroupID: core.StringPtr(instanceGroupID),
InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID),
ID: core.StringPtr(id),
}
}
// SetInstanceGroupID : Allow user to set InstanceGroupID
func (_options *GetInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerActionOptions {
_options.InstanceGroupID = core.StringPtr(instanceGroupID)
return _options
}
// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID
func (_options *GetInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *GetInstanceGroupManagerActionOptions {
_options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetInstanceGroupManagerActionOptions) SetID(id string) *GetInstanceGroupManagerActionOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerActionOptions {
options.Headers = param
return options
}
// GetInstanceGroupManagerOptions : The GetInstanceGroupManager options.
type GetInstanceGroupManagerOptions struct {
// The instance group identifier.
InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="`
// The instance group manager identifier.
ID *string `json:"id" 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 `json:"instance_group_id" validate:"required,ne="`
// The instance group manager identifier.
InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="`
// The instance group manager policy identifier.
ID *string `json:"id" 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 `json:"instance_group_id" validate:"required,ne="`
// The instance group membership identifier.
ID *string `json:"id" 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 `json:"id" 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 `json:"id" 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
}
// GetInstanceNetworkAttachmentOptions : The GetInstanceNetworkAttachment options.
type GetInstanceNetworkAttachmentOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance network attachment identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetInstanceNetworkAttachmentOptions : Instantiate GetInstanceNetworkAttachmentOptions
func (*VpcV1) NewGetInstanceNetworkAttachmentOptions(instanceID string, id string) *GetInstanceNetworkAttachmentOptions {
return &GetInstanceNetworkAttachmentOptions{
InstanceID: core.StringPtr(instanceID),
ID: core.StringPtr(id),
}
}
// SetInstanceID : Allow user to set InstanceID
func (_options *GetInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *GetInstanceNetworkAttachmentOptions {
_options.InstanceID = core.StringPtr(instanceID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetInstanceNetworkAttachmentOptions) SetID(id string) *GetInstanceNetworkAttachmentOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *GetInstanceNetworkAttachmentOptions {
options.Headers = param
return options
}
// GetInstanceNetworkInterfaceFloatingIPOptions : The GetInstanceNetworkInterfaceFloatingIP options.
type GetInstanceNetworkInterfaceFloatingIPOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance network interface identifier.
NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="`
// The floating IP identifier.
ID *string `json:"id" 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
}
// GetInstanceNetworkInterfaceIPOptions : The GetInstanceNetworkInterfaceIP options.
type GetInstanceNetworkInterfaceIPOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance network interface identifier.
NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="`
// The reserved IP identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetInstanceNetworkInterfaceIPOptions : Instantiate GetInstanceNetworkInterfaceIPOptions
func (*VpcV1) NewGetInstanceNetworkInterfaceIPOptions(instanceID string, networkInterfaceID string, id string) *GetInstanceNetworkInterfaceIPOptions {
return &GetInstanceNetworkInterfaceIPOptions{
InstanceID: core.StringPtr(instanceID),
NetworkInterfaceID: core.StringPtr(networkInterfaceID),
ID: core.StringPtr(id),
}
}
// SetInstanceID : Allow user to set InstanceID
func (_options *GetInstanceNetworkInterfaceIPOptions) SetInstanceID(instanceID string) *GetInstanceNetworkInterfaceIPOptions {
_options.InstanceID = core.StringPtr(instanceID)
return _options
}
// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID
func (_options *GetInstanceNetworkInterfaceIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetInstanceNetworkInterfaceIPOptions {
_options.NetworkInterfaceID = core.StringPtr(networkInterfaceID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetInstanceNetworkInterfaceIPOptions) SetID(id string) *GetInstanceNetworkInterfaceIPOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetInstanceNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetInstanceNetworkInterfaceIPOptions {
options.Headers = param
return options
}
// GetInstanceNetworkInterfaceOptions : The GetInstanceNetworkInterface options.
type GetInstanceNetworkInterfaceOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance network interface identifier.
ID *string `json:"id" 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 virtual server instance identifier.
ID *string `json:"id" 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 `json:"name" 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 `json:"id" 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 virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The volume attachment identifier.
ID *string `json:"id" 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 `json:"id" 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 `json:"id" 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 `json:"load_balancer_id" validate:"required,ne="`
// The listener identifier.
ID *string `json:"id" 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 `json:"load_balancer_id" validate:"required,ne="`
// The listener identifier.
ListenerID *string `json:"listener_id" validate:"required,ne="`
// The policy identifier.
ID *string `json:"id" 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 `json:"load_balancer_id" validate:"required,ne="`
// The listener identifier.
ListenerID *string `json:"listener_id" validate:"required,ne="`
// The policy identifier.
PolicyID *string `json:"policy_id" validate:"required,ne="`
// The rule identifier.
ID *string `json:"id" 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 `json:"id" 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 `json:"load_balancer_id" validate:"required,ne="`
// The pool identifier.
PoolID *string `json:"pool_id" validate:"required,ne="`
// The member identifier.
ID *string `json:"id" 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 `json:"load_balancer_id" validate:"required,ne="`
// The pool identifier.
ID *string `json:"id" 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 `json:"name" 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 `json:"id" 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 `json:"id" 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 `json:"network_acl_id" validate:"required,ne="`
// The rule identifier.
ID *string `json:"id" 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
}
// GetNetworkInterfaceFloatingIPOptions : The GetNetworkInterfaceFloatingIP options.
type GetNetworkInterfaceFloatingIPOptions struct {
// The virtual network interface identifier.
VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="`
// The floating IP identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetNetworkInterfaceFloatingIPOptions : Instantiate GetNetworkInterfaceFloatingIPOptions
func (*VpcV1) NewGetNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *GetNetworkInterfaceFloatingIPOptions {
return &GetNetworkInterfaceFloatingIPOptions{
VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID),
ID: core.StringPtr(id),
}
}
// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID
func (_options *GetNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *GetNetworkInterfaceFloatingIPOptions {
_options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetNetworkInterfaceFloatingIPOptions) SetID(id string) *GetNetworkInterfaceFloatingIPOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *GetNetworkInterfaceFloatingIPOptions {
options.Headers = param
return options
}
// GetOperatingSystemOptions : The GetOperatingSystem options.
type GetOperatingSystemOptions struct {
// The operating system name.
Name *string `json:"name" 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
}
// GetPlacementGroupOptions : The GetPlacementGroup options.
type GetPlacementGroupOptions struct {
// The placement group identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetPlacementGroupOptions : Instantiate GetPlacementGroupOptions
func (*VpcV1) NewGetPlacementGroupOptions(id string) *GetPlacementGroupOptions {
return &GetPlacementGroupOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *GetPlacementGroupOptions) SetID(id string) *GetPlacementGroupOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetPlacementGroupOptions) SetHeaders(param map[string]string) *GetPlacementGroupOptions {
options.Headers = param
return options
}
// GetPrivatePathServiceGatewayAccountPolicyOptions : The GetPrivatePathServiceGatewayAccountPolicy options.
type GetPrivatePathServiceGatewayAccountPolicyOptions struct {
// The private path service gateway identifier.
PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="`
// The account policy identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetPrivatePathServiceGatewayAccountPolicyOptions : Instantiate GetPrivatePathServiceGatewayAccountPolicyOptions
func (*VpcV1) NewGetPrivatePathServiceGatewayAccountPolicyOptions(privatePathServiceGatewayID string, id string) *GetPrivatePathServiceGatewayAccountPolicyOptions {
return &GetPrivatePathServiceGatewayAccountPolicyOptions{
PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID),
ID: core.StringPtr(id),
}
}
// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID
func (_options *GetPrivatePathServiceGatewayAccountPolicyOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *GetPrivatePathServiceGatewayAccountPolicyOptions {
_options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetPrivatePathServiceGatewayAccountPolicyOptions) SetID(id string) *GetPrivatePathServiceGatewayAccountPolicyOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetPrivatePathServiceGatewayAccountPolicyOptions) SetHeaders(param map[string]string) *GetPrivatePathServiceGatewayAccountPolicyOptions {
options.Headers = param
return options
}
// GetPrivatePathServiceGatewayEndpointGatewayBindingOptions : The GetPrivatePathServiceGatewayEndpointGatewayBinding options.
type GetPrivatePathServiceGatewayEndpointGatewayBindingOptions struct {
// The private path service gateway identifier.
PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="`
// The endpoint gateway binding identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetPrivatePathServiceGatewayEndpointGatewayBindingOptions : Instantiate GetPrivatePathServiceGatewayEndpointGatewayBindingOptions
func (*VpcV1) NewGetPrivatePathServiceGatewayEndpointGatewayBindingOptions(privatePathServiceGatewayID string, id string) *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions {
return &GetPrivatePathServiceGatewayEndpointGatewayBindingOptions{
PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID),
ID: core.StringPtr(id),
}
}
// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID
func (_options *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions {
_options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetID(id string) *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetHeaders(param map[string]string) *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions {
options.Headers = param
return options
}
// GetPrivatePathServiceGatewayOptions : The GetPrivatePathServiceGateway options.
type GetPrivatePathServiceGatewayOptions struct {
// The private path service gateway identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetPrivatePathServiceGatewayOptions : Instantiate GetPrivatePathServiceGatewayOptions
func (*VpcV1) NewGetPrivatePathServiceGatewayOptions(id string) *GetPrivatePathServiceGatewayOptions {
return &GetPrivatePathServiceGatewayOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *GetPrivatePathServiceGatewayOptions) SetID(id string) *GetPrivatePathServiceGatewayOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetPrivatePathServiceGatewayOptions) SetHeaders(param map[string]string) *GetPrivatePathServiceGatewayOptions {
options.Headers = param
return options
}
// GetPublicAddressRangeOptions : The GetPublicAddressRange options.
type GetPublicAddressRangeOptions struct {
// The public address range identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetPublicAddressRangeOptions : Instantiate GetPublicAddressRangeOptions
func (*VpcV1) NewGetPublicAddressRangeOptions(id string) *GetPublicAddressRangeOptions {
return &GetPublicAddressRangeOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *GetPublicAddressRangeOptions) SetID(id string) *GetPublicAddressRangeOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetPublicAddressRangeOptions) SetHeaders(param map[string]string) *GetPublicAddressRangeOptions {
options.Headers = param
return options
}
// GetPublicGatewayOptions : The GetPublicGateway options.
type GetPublicGatewayOptions struct {
// The public gateway identifier.
ID *string `json:"id" 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 `json:"name" 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 `json:"region_name" validate:"required,ne="`
// The zone name.
Name *string `json:"name" 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
}
// GetReservationOptions : The GetReservation options.
type GetReservationOptions struct {
// The reservation identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetReservationOptions : Instantiate GetReservationOptions
func (*VpcV1) NewGetReservationOptions(id string) *GetReservationOptions {
return &GetReservationOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *GetReservationOptions) SetID(id string) *GetReservationOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetReservationOptions) SetHeaders(param map[string]string) *GetReservationOptions {
options.Headers = param
return options
}
// GetSecurityGroupOptions : The GetSecurityGroup options.
type GetSecurityGroupOptions struct {
// The security group identifier.
ID *string `json:"id" 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 `json:"security_group_id" validate:"required,ne="`
// The rule identifier.
ID *string `json:"id" 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 `json:"security_group_id" validate:"required,ne="`
// The security group target identifier.
ID *string `json:"id" 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
}
// GetShareAccessorBindingOptions : The GetShareAccessorBinding options.
type GetShareAccessorBindingOptions struct {
// The file share identifier.
ShareID *string `json:"share_id" validate:"required,ne="`
// The file share accessor binding identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetShareAccessorBindingOptions : Instantiate GetShareAccessorBindingOptions
func (*VpcV1) NewGetShareAccessorBindingOptions(shareID string, id string) *GetShareAccessorBindingOptions {
return &GetShareAccessorBindingOptions{
ShareID: core.StringPtr(shareID),
ID: core.StringPtr(id),
}
}
// SetShareID : Allow user to set ShareID
func (_options *GetShareAccessorBindingOptions) SetShareID(shareID string) *GetShareAccessorBindingOptions {
_options.ShareID = core.StringPtr(shareID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetShareAccessorBindingOptions) SetID(id string) *GetShareAccessorBindingOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetShareAccessorBindingOptions) SetHeaders(param map[string]string) *GetShareAccessorBindingOptions {
options.Headers = param
return options
}
// GetShareMountTargetOptions : The GetShareMountTarget options.
type GetShareMountTargetOptions struct {
// The file share identifier.
ShareID *string `json:"share_id" validate:"required,ne="`
// The file share mount target identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetShareMountTargetOptions : Instantiate GetShareMountTargetOptions
func (*VpcV1) NewGetShareMountTargetOptions(shareID string, id string) *GetShareMountTargetOptions {
return &GetShareMountTargetOptions{
ShareID: core.StringPtr(shareID),
ID: core.StringPtr(id),
}
}
// SetShareID : Allow user to set ShareID
func (_options *GetShareMountTargetOptions) SetShareID(shareID string) *GetShareMountTargetOptions {
_options.ShareID = core.StringPtr(shareID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetShareMountTargetOptions) SetID(id string) *GetShareMountTargetOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetShareMountTargetOptions) SetHeaders(param map[string]string) *GetShareMountTargetOptions {
options.Headers = param
return options
}
// GetShareOptions : The GetShare options.
type GetShareOptions struct {
// The file share identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetShareOptions : Instantiate GetShareOptions
func (*VpcV1) NewGetShareOptions(id string) *GetShareOptions {
return &GetShareOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *GetShareOptions) SetID(id string) *GetShareOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetShareOptions) SetHeaders(param map[string]string) *GetShareOptions {
options.Headers = param
return options
}
// GetShareProfileOptions : The GetShareProfile options.
type GetShareProfileOptions struct {
// The file share profile name.
Name *string `json:"name" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetShareProfileOptions : Instantiate GetShareProfileOptions
func (*VpcV1) NewGetShareProfileOptions(name string) *GetShareProfileOptions {
return &GetShareProfileOptions{
Name: core.StringPtr(name),
}
}
// SetName : Allow user to set Name
func (_options *GetShareProfileOptions) SetName(name string) *GetShareProfileOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetShareProfileOptions) SetHeaders(param map[string]string) *GetShareProfileOptions {
options.Headers = param
return options
}
// GetShareSnapshotOptions : The GetShareSnapshot options.
type GetShareSnapshotOptions struct {
// The file share identifier.
ShareID *string `json:"share_id" validate:"required,ne="`
// The share snapshot identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetShareSnapshotOptions : Instantiate GetShareSnapshotOptions
func (*VpcV1) NewGetShareSnapshotOptions(shareID string, id string) *GetShareSnapshotOptions {
return &GetShareSnapshotOptions{
ShareID: core.StringPtr(shareID),
ID: core.StringPtr(id),
}
}
// SetShareID : Allow user to set ShareID
func (_options *GetShareSnapshotOptions) SetShareID(shareID string) *GetShareSnapshotOptions {
_options.ShareID = core.StringPtr(shareID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetShareSnapshotOptions) SetID(id string) *GetShareSnapshotOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetShareSnapshotOptions) SetHeaders(param map[string]string) *GetShareSnapshotOptions {
options.Headers = param
return options
}
// GetShareSourceOptions : The GetShareSource options.
type GetShareSourceOptions struct {
// The file share identifier.
ShareID *string `json:"share_id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetShareSourceOptions : Instantiate GetShareSourceOptions
func (*VpcV1) NewGetShareSourceOptions(shareID string) *GetShareSourceOptions {
return &GetShareSourceOptions{
ShareID: core.StringPtr(shareID),
}
}
// SetShareID : Allow user to set ShareID
func (_options *GetShareSourceOptions) SetShareID(shareID string) *GetShareSourceOptions {
_options.ShareID = core.StringPtr(shareID)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetShareSourceOptions) SetHeaders(param map[string]string) *GetShareSourceOptions {
options.Headers = param
return options
}
// GetSnapshotCloneOptions : The GetSnapshotClone options.
type GetSnapshotCloneOptions struct {
// The snapshot identifier.
ID *string `json:"id" validate:"required,ne="`
// The zone name.
ZoneName *string `json:"zone_name" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetSnapshotCloneOptions : Instantiate GetSnapshotCloneOptions
func (*VpcV1) NewGetSnapshotCloneOptions(id string, zoneName string) *GetSnapshotCloneOptions {
return &GetSnapshotCloneOptions{
ID: core.StringPtr(id),
ZoneName: core.StringPtr(zoneName),
}
}
// SetID : Allow user to set ID
func (_options *GetSnapshotCloneOptions) SetID(id string) *GetSnapshotCloneOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetZoneName : Allow user to set ZoneName
func (_options *GetSnapshotCloneOptions) SetZoneName(zoneName string) *GetSnapshotCloneOptions {
_options.ZoneName = core.StringPtr(zoneName)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetSnapshotCloneOptions) SetHeaders(param map[string]string) *GetSnapshotCloneOptions {
options.Headers = param
return options
}
// GetSnapshotConsistencyGroupOptions : The GetSnapshotConsistencyGroup options.
type GetSnapshotConsistencyGroupOptions struct {
// The snapshot consistency group identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetSnapshotConsistencyGroupOptions : Instantiate GetSnapshotConsistencyGroupOptions
func (*VpcV1) NewGetSnapshotConsistencyGroupOptions(id string) *GetSnapshotConsistencyGroupOptions {
return &GetSnapshotConsistencyGroupOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *GetSnapshotConsistencyGroupOptions) SetID(id string) *GetSnapshotConsistencyGroupOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetSnapshotConsistencyGroupOptions) SetHeaders(param map[string]string) *GetSnapshotConsistencyGroupOptions {
options.Headers = param
return options
}
// GetSnapshotOptions : The GetSnapshot options.
type GetSnapshotOptions struct {
// The snapshot identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetSnapshotOptions : Instantiate GetSnapshotOptions
func (*VpcV1) NewGetSnapshotOptions(id string) *GetSnapshotOptions {
return &GetSnapshotOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *GetSnapshotOptions) SetID(id string) *GetSnapshotOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetSnapshotOptions) SetHeaders(param map[string]string) *GetSnapshotOptions {
options.Headers = param
return options
}
// GetSubnetNetworkACLOptions : The GetSubnetNetworkACL options.
type GetSubnetNetworkACLOptions struct {
// The subnet identifier.
ID *string `json:"id" 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 `json:"id" 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 `json:"id" 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 `json:"subnet_id" validate:"required,ne="`
// The reserved IP identifier.
ID *string `json:"id" 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 `json:"id" 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
}
// GetVirtualNetworkInterfaceIPOptions : The GetVirtualNetworkInterfaceIP options.
type GetVirtualNetworkInterfaceIPOptions struct {
// The virtual network interface identifier.
VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="`
// The reserved IP identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetVirtualNetworkInterfaceIPOptions : Instantiate GetVirtualNetworkInterfaceIPOptions
func (*VpcV1) NewGetVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *GetVirtualNetworkInterfaceIPOptions {
return &GetVirtualNetworkInterfaceIPOptions{
VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID),
ID: core.StringPtr(id),
}
}
// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID
func (_options *GetVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *GetVirtualNetworkInterfaceIPOptions {
_options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetVirtualNetworkInterfaceIPOptions) SetID(id string) *GetVirtualNetworkInterfaceIPOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetVirtualNetworkInterfaceIPOptions {
options.Headers = param
return options
}
// GetVirtualNetworkInterfaceOptions : The GetVirtualNetworkInterface options.
type GetVirtualNetworkInterfaceOptions struct {
// The virtual network interface identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetVirtualNetworkInterfaceOptions : Instantiate GetVirtualNetworkInterfaceOptions
func (*VpcV1) NewGetVirtualNetworkInterfaceOptions(id string) *GetVirtualNetworkInterfaceOptions {
return &GetVirtualNetworkInterfaceOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *GetVirtualNetworkInterfaceOptions) SetID(id string) *GetVirtualNetworkInterfaceOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetVirtualNetworkInterfaceOptions {
options.Headers = param
return options
}
// GetVolumeOptions : The GetVolume options.
type GetVolumeOptions struct {
// The volume identifier.
ID *string `json:"id" 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 `json:"name" 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 `json:"vpc_id" validate:"required,ne="`
// The prefix identifier.
ID *string `json:"id" 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 `json:"id" 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 `json:"id" 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 `json:"id" 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
}
// GetVPCDnsResolutionBindingOptions : The GetVPCDnsResolutionBinding options.
type GetVPCDnsResolutionBindingOptions struct {
// The VPC identifier.
VPCID *string `json:"vpc_id" validate:"required,ne="`
// The DNS resolution binding identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetVPCDnsResolutionBindingOptions : Instantiate GetVPCDnsResolutionBindingOptions
func (*VpcV1) NewGetVPCDnsResolutionBindingOptions(vpcID string, id string) *GetVPCDnsResolutionBindingOptions {
return &GetVPCDnsResolutionBindingOptions{
VPCID: core.StringPtr(vpcID),
ID: core.StringPtr(id),
}
}
// SetVPCID : Allow user to set VPCID
func (_options *GetVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *GetVPCDnsResolutionBindingOptions {
_options.VPCID = core.StringPtr(vpcID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetVPCDnsResolutionBindingOptions) SetID(id string) *GetVPCDnsResolutionBindingOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *GetVPCDnsResolutionBindingOptions {
options.Headers = param
return options
}
// GetVPCOptions : The GetVPC options.
type GetVPCOptions struct {
// The VPC identifier.
ID *string `json:"id" 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 `json:"vpc_id" validate:"required,ne="`
// The route identifier.
ID *string `json:"id" 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 `json:"vpc_id" validate:"required,ne="`
// The routing table identifier.
ID *string `json:"id" 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 `json:"vpc_id" validate:"required,ne="`
// The routing table identifier.
RoutingTableID *string `json:"routing_table_id" validate:"required,ne="`
// The VPC routing table route identifier.
ID *string `json:"id" 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 `json:"vpn_gateway_id" validate:"required,ne="`
// The VPN gateway connection identifier.
ID *string `json:"id" 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 `json:"id" 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
}
// GetVPNServerClientConfigurationOptions : The GetVPNServerClientConfiguration options.
type GetVPNServerClientConfigurationOptions struct {
// The VPN server identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetVPNServerClientConfigurationOptions : Instantiate GetVPNServerClientConfigurationOptions
func (*VpcV1) NewGetVPNServerClientConfigurationOptions(id string) *GetVPNServerClientConfigurationOptions {
return &GetVPNServerClientConfigurationOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *GetVPNServerClientConfigurationOptions) SetID(id string) *GetVPNServerClientConfigurationOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetVPNServerClientConfigurationOptions) SetHeaders(param map[string]string) *GetVPNServerClientConfigurationOptions {
options.Headers = param
return options
}
// GetVPNServerClientOptions : The GetVPNServerClient options.
type GetVPNServerClientOptions struct {
// The VPN server identifier.
VPNServerID *string `json:"vpn_server_id" validate:"required,ne="`
// The VPN client identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetVPNServerClientOptions : Instantiate GetVPNServerClientOptions
func (*VpcV1) NewGetVPNServerClientOptions(vpnServerID string, id string) *GetVPNServerClientOptions {
return &GetVPNServerClientOptions{
VPNServerID: core.StringPtr(vpnServerID),
ID: core.StringPtr(id),
}
}
// SetVPNServerID : Allow user to set VPNServerID
func (_options *GetVPNServerClientOptions) SetVPNServerID(vpnServerID string) *GetVPNServerClientOptions {
_options.VPNServerID = core.StringPtr(vpnServerID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetVPNServerClientOptions) SetID(id string) *GetVPNServerClientOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetVPNServerClientOptions) SetHeaders(param map[string]string) *GetVPNServerClientOptions {
options.Headers = param
return options
}
// GetVPNServerOptions : The GetVPNServer options.
type GetVPNServerOptions struct {
// The VPN server identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetVPNServerOptions : Instantiate GetVPNServerOptions
func (*VpcV1) NewGetVPNServerOptions(id string) *GetVPNServerOptions {
return &GetVPNServerOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *GetVPNServerOptions) SetID(id string) *GetVPNServerOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetVPNServerOptions) SetHeaders(param map[string]string) *GetVPNServerOptions {
options.Headers = param
return options
}
// GetVPNServerRouteOptions : The GetVPNServerRoute options.
type GetVPNServerRouteOptions struct {
// The VPN server identifier.
VPNServerID *string `json:"vpn_server_id" validate:"required,ne="`
// The VPN route identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewGetVPNServerRouteOptions : Instantiate GetVPNServerRouteOptions
func (*VpcV1) NewGetVPNServerRouteOptions(vpnServerID string, id string) *GetVPNServerRouteOptions {
return &GetVPNServerRouteOptions{
VPNServerID: core.StringPtr(vpnServerID),
ID: core.StringPtr(id),
}
}
// SetVPNServerID : Allow user to set VPNServerID
func (_options *GetVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *GetVPNServerRouteOptions {
_options.VPNServerID = core.StringPtr(vpnServerID)
return _options
}
// SetID : Allow user to set ID
func (_options *GetVPNServerRouteOptions) SetID(id string) *GetVPNServerRouteOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *GetVPNServerRouteOptions) SetHeaders(param map[string]string) *GetVPNServerRouteOptions {
options.Headers = param
return options
}
// IkePolicy : IkePolicy struct
type IkePolicy struct {
// The authentication algorithm.
//
// The `md5` and `sha1` algorithms have been deprecated.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"`
// The 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
//
// Groups `2` and `5` have been deprecated.
DhGroup *int64 `json:"dh_group" validate:"required"`
// The encryption algorithm.
//
// The `triple_des` algorithm has been deprecated.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"`
// The URL for this IKE policy.
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 name for this IKE policy. The name is unique across all IKE policies in the region.
Name *string `json:"name" validate:"required"`
// The IKE negotiation mode.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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.
//
// The `md5` and `sha1` algorithms have been deprecated.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
IkePolicyAuthenticationAlgorithmMd5Const = "md5"
IkePolicyAuthenticationAlgorithmSha1Const = "sha1"
IkePolicyAuthenticationAlgorithmSha256Const = "sha256"
IkePolicyAuthenticationAlgorithmSha384Const = "sha384"
IkePolicyAuthenticationAlgorithmSha512Const = "sha512"
)
// Constants associated with the IkePolicy.EncryptionAlgorithm property.
// The encryption algorithm.
//
// The `triple_des` algorithm has been deprecated.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
IkePolicyEncryptionAlgorithmAes128Const = "aes128"
IkePolicyEncryptionAlgorithmAes192Const = "aes192"
IkePolicyEncryptionAlgorithmAes256Const = "aes256"
IkePolicyEncryptionAlgorithmTripleDesConst = "triple_des"
)
// Constants associated with the IkePolicy.NegotiationMode property.
// The IKE negotiation mode.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 {
err = core.SDKErrorf(err, "", "authentication_algorithm-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference)
if err != nil {
err = core.SDKErrorf(err, "", "connections-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "dh_group", &obj.DhGroup)
if err != nil {
err = core.SDKErrorf(err, "", "dh_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm)
if err != nil {
err = core.SDKErrorf(err, "", "encryption_algorithm-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "ike_version", &obj.IkeVersion)
if err != nil {
err = core.SDKErrorf(err, "", "ike_version-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime)
if err != nil {
err = core.SDKErrorf(err, "", "key_lifetime-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "negotiation_mode", &obj.NegotiationMode)
if err != nil {
err = core.SDKErrorf(err, "", "negotiation_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
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 *PageLink `json:"first" validate:"required"`
// A page 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 *PageLink `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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ike_policies", &obj.IkePolicies, UnmarshalIkePolicy)
if err != nil {
err = core.SDKErrorf(err, "", "ike_policies-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *IkePolicyCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// IkePolicyConnectionCollection : IkePolicyConnectionCollection struct
type IkePolicyConnectionCollection struct {
// A page of VPN gateway connections that use the IKE policy specified by the identifier in the URL.
Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"`
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalIkePolicyConnectionCollection unmarshals an instance of IkePolicyConnectionCollection from the specified map of raw messages.
func UnmarshalIkePolicyConnectionCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(IkePolicyConnectionCollection)
err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnection)
if err != nil {
err = core.SDKErrorf(err, "", "connections-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *IkePolicyConnectionCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// 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 name for this IKE policy. The name must not be used by another IKE policy in the region.
Name *string `json:"name,omitempty"`
}
// Constants associated with the IkePolicyPatch.AuthenticationAlgorithm property.
// The authentication algorithm.
const (
IkePolicyPatchAuthenticationAlgorithmSha256Const = "sha256"
IkePolicyPatchAuthenticationAlgorithmSha384Const = "sha384"
IkePolicyPatchAuthenticationAlgorithmSha512Const = "sha512"
)
// Constants associated with the IkePolicyPatch.EncryptionAlgorithm property.
// The encryption algorithm.
const (
IkePolicyPatchEncryptionAlgorithmAes128Const = "aes128"
IkePolicyPatchEncryptionAlgorithmAes192Const = "aes192"
IkePolicyPatchEncryptionAlgorithmAes256Const = "aes256"
)
// 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 {
err = core.SDKErrorf(err, "", "authentication_algorithm-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "dh_group", &obj.DhGroup)
if err != nil {
err = core.SDKErrorf(err, "", "dh_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm)
if err != nil {
err = core.SDKErrorf(err, "", "encryption_algorithm-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "ike_version", &obj.IkeVersion)
if err != nil {
err = core.SDKErrorf(err, "", "ike_version-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime)
if err != nil {
err = core.SDKErrorf(err, "", "key_lifetime-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(ikePolicyPatch.AuthenticationAlgorithm) {
_patch["authentication_algorithm"] = ikePolicyPatch.AuthenticationAlgorithm
}
if !core.IsNil(ikePolicyPatch.DhGroup) {
_patch["dh_group"] = ikePolicyPatch.DhGroup
}
if !core.IsNil(ikePolicyPatch.EncryptionAlgorithm) {
_patch["encryption_algorithm"] = ikePolicyPatch.EncryptionAlgorithm
}
if !core.IsNil(ikePolicyPatch.IkeVersion) {
_patch["ike_version"] = ikePolicyPatch.IkeVersion
}
if !core.IsNil(ikePolicyPatch.KeyLifetime) {
_patch["key_lifetime"] = ikePolicyPatch.KeyLifetime
}
if !core.IsNil(ikePolicyPatch.Name) {
_patch["name"] = ikePolicyPatch.Name
}
return
}
// IkePolicyReference : IkePolicyReference struct
type IkePolicyReference struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this IKE policy.
Href *string `json:"href" validate:"required"`
// The unique identifier for this IKE policy.
ID *string `json:"id" validate:"required"`
// The name for this IKE policy. The name is unique across all IKE policies in the region.
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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// IP : IP struct
type IP struct {
// The IP address.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in
// the future.
Address *string `json:"address" validate:"required"`
}
// NewIP : Instantiate IP (Generic Model Constructor)
func (*VpcV1) NewIP(address string) (_model *IP, err error) {
_model = &IP{
Address: core.StringPtr(address),
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// 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 {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the IP
func (ip *IP) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(ip.Address) {
_patch["address"] = ip.Address
}
return
}
// IPsecPolicy : IPsecPolicy struct
type IPsecPolicy struct {
// The authentication algorithm
//
// The `md5` and `sha1` algorithms have been deprecated
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"`
// The 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.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
EncapsulationMode *string `json:"encapsulation_mode" validate:"required"`
// The encryption algorithm
//
// The `triple_des` algorithm has been deprecated
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"`
// The URL for this IPsec policy.
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 name for this IPsec policy. The name is unique across all IPsec policies in the region.
Name *string `json:"name" validate:"required"`
// The Perfect Forward Secrecy group
//
// Groups `group_2` and `group_5` have been deprecated
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
TransformProtocol *string `json:"transform_protocol" validate:"required"`
}
// Constants associated with the IPsecPolicy.AuthenticationAlgorithm property.
// The authentication algorithm
//
// # The `md5` and `sha1` algorithms have been deprecated
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
IPsecPolicyAuthenticationAlgorithmDisabledConst = "disabled"
IPsecPolicyAuthenticationAlgorithmMd5Const = "md5"
IPsecPolicyAuthenticationAlgorithmSha1Const = "sha1"
IPsecPolicyAuthenticationAlgorithmSha256Const = "sha256"
IPsecPolicyAuthenticationAlgorithmSha384Const = "sha384"
IPsecPolicyAuthenticationAlgorithmSha512Const = "sha512"
)
// Constants associated with the IPsecPolicy.EncapsulationMode property.
// The encapsulation mode used.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
IPsecPolicyEncapsulationModeTunnelConst = "tunnel"
)
// Constants associated with the IPsecPolicy.EncryptionAlgorithm property.
// The encryption algorithm
//
// The `triple_des` algorithm has been deprecated
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
IPsecPolicyEncryptionAlgorithmAes128Const = "aes128"
IPsecPolicyEncryptionAlgorithmAes128gcm16Const = "aes128gcm16"
IPsecPolicyEncryptionAlgorithmAes192Const = "aes192"
IPsecPolicyEncryptionAlgorithmAes192gcm16Const = "aes192gcm16"
IPsecPolicyEncryptionAlgorithmAes256Const = "aes256"
IPsecPolicyEncryptionAlgorithmAes256gcm16Const = "aes256gcm16"
IPsecPolicyEncryptionAlgorithmTripleDesConst = "triple_des"
)
// Constants associated with the IPsecPolicy.Pfs property.
// The Perfect Forward Secrecy group
//
// Groups `group_2` and `group_5` have been deprecated
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
IPsecPolicyPfsDisabledConst = "disabled"
IPsecPolicyPfsGroup14Const = "group_14"
IPsecPolicyPfsGroup15Const = "group_15"
IPsecPolicyPfsGroup16Const = "group_16"
IPsecPolicyPfsGroup17Const = "group_17"
IPsecPolicyPfsGroup18Const = "group_18"
IPsecPolicyPfsGroup19Const = "group_19"
IPsecPolicyPfsGroup2Const = "group_2"
IPsecPolicyPfsGroup20Const = "group_20"
IPsecPolicyPfsGroup21Const = "group_21"
IPsecPolicyPfsGroup22Const = "group_22"
IPsecPolicyPfsGroup23Const = "group_23"
IPsecPolicyPfsGroup24Const = "group_24"
IPsecPolicyPfsGroup31Const = "group_31"
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.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 {
err = core.SDKErrorf(err, "", "authentication_algorithm-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference)
if err != nil {
err = core.SDKErrorf(err, "", "connections-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "encapsulation_mode", &obj.EncapsulationMode)
if err != nil {
err = core.SDKErrorf(err, "", "encapsulation_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm)
if err != nil {
err = core.SDKErrorf(err, "", "encryption_algorithm-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime)
if err != nil {
err = core.SDKErrorf(err, "", "key_lifetime-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "pfs", &obj.Pfs)
if err != nil {
err = core.SDKErrorf(err, "", "pfs-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "transform_protocol", &obj.TransformProtocol)
if err != nil {
err = core.SDKErrorf(err, "", "transform_protocol-error", common.GetComponentInfo())
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 *PageLink `json:"first" validate:"required"`
// A page 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 *PageLink `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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ipsec_policies", &obj.IpsecPolicies, UnmarshalIPsecPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "ipsec_policies-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *IPsecPolicyCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// IPsecPolicyConnectionCollection : IPsecPolicyConnectionCollection struct
type IPsecPolicyConnectionCollection struct {
// A page of VPN gateway connections that use the IPsec policy specified by the identifier in the URL.
Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"`
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalIPsecPolicyConnectionCollection unmarshals an instance of IPsecPolicyConnectionCollection from the specified map of raw messages.
func UnmarshalIPsecPolicyConnectionCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(IPsecPolicyConnectionCollection)
err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnection)
if err != nil {
err = core.SDKErrorf(err, "", "connections-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *IPsecPolicyConnectionCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// IPsecPolicyPatch : IPsecPolicyPatch struct
type IPsecPolicyPatch struct {
// The authentication algorithm
//
// Must be `disabled` if and only if the `encryption_algorithm` is `aes128gcm16`,
// `aes192gcm16`, or `aes256gcm16`
//
// The `md5` and `sha1` algorithms have been deprecated.
AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"`
// The encryption algorithm
//
// The `authentication_algorithm` must be `disabled` if and only if
// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`
//
// The `triple_des` algorithm has been deprecated.
EncryptionAlgorithm *string `json:"encryption_algorithm,omitempty"`
// The key lifetime in seconds.
KeyLifetime *int64 `json:"key_lifetime,omitempty"`
// The name for this IPsec policy. The name must not be used by another IPsec policy in the region.
Name *string `json:"name,omitempty"`
// The Perfect Forward Secrecy group.
//
// Groups `group_2` and `group_5` have been deprecated.
Pfs *string `json:"pfs,omitempty"`
}
// Constants associated with the IPsecPolicyPatch.AuthenticationAlgorithm property.
// The authentication algorithm
//
// Must be `disabled` if and only if the `encryption_algorithm` is `aes128gcm16`,
// `aes192gcm16`, or `aes256gcm16`
//
// The `md5` and `sha1` algorithms have been deprecated.
const (
IPsecPolicyPatchAuthenticationAlgorithmDisabledConst = "disabled"
IPsecPolicyPatchAuthenticationAlgorithmSha256Const = "sha256"
IPsecPolicyPatchAuthenticationAlgorithmSha384Const = "sha384"
IPsecPolicyPatchAuthenticationAlgorithmSha512Const = "sha512"
)
// Constants associated with the IPsecPolicyPatch.EncryptionAlgorithm property.
// The encryption algorithm
//
// The `authentication_algorithm` must be `disabled` if and only if
// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`
//
// The `triple_des` algorithm has been deprecated.
const (
IPsecPolicyPatchEncryptionAlgorithmAes128Const = "aes128"
IPsecPolicyPatchEncryptionAlgorithmAes128gcm16Const = "aes128gcm16"
IPsecPolicyPatchEncryptionAlgorithmAes192Const = "aes192"
IPsecPolicyPatchEncryptionAlgorithmAes192gcm16Const = "aes192gcm16"
IPsecPolicyPatchEncryptionAlgorithmAes256Const = "aes256"
IPsecPolicyPatchEncryptionAlgorithmAes256gcm16Const = "aes256gcm16"
)
// Constants associated with the IPsecPolicyPatch.Pfs property.
// The Perfect Forward Secrecy group.
//
// Groups `group_2` and `group_5` have been deprecated.
const (
IPsecPolicyPatchPfsDisabledConst = "disabled"
IPsecPolicyPatchPfsGroup14Const = "group_14"
IPsecPolicyPatchPfsGroup15Const = "group_15"
IPsecPolicyPatchPfsGroup16Const = "group_16"
IPsecPolicyPatchPfsGroup17Const = "group_17"
IPsecPolicyPatchPfsGroup18Const = "group_18"
IPsecPolicyPatchPfsGroup19Const = "group_19"
IPsecPolicyPatchPfsGroup20Const = "group_20"
IPsecPolicyPatchPfsGroup21Const = "group_21"
IPsecPolicyPatchPfsGroup22Const = "group_22"
IPsecPolicyPatchPfsGroup23Const = "group_23"
IPsecPolicyPatchPfsGroup24Const = "group_24"
IPsecPolicyPatchPfsGroup31Const = "group_31"
)
// 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 {
err = core.SDKErrorf(err, "", "authentication_algorithm-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm)
if err != nil {
err = core.SDKErrorf(err, "", "encryption_algorithm-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime)
if err != nil {
err = core.SDKErrorf(err, "", "key_lifetime-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "pfs", &obj.Pfs)
if err != nil {
err = core.SDKErrorf(err, "", "pfs-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(iPsecPolicyPatch.AuthenticationAlgorithm) {
_patch["authentication_algorithm"] = iPsecPolicyPatch.AuthenticationAlgorithm
}
if !core.IsNil(iPsecPolicyPatch.EncryptionAlgorithm) {
_patch["encryption_algorithm"] = iPsecPolicyPatch.EncryptionAlgorithm
}
if !core.IsNil(iPsecPolicyPatch.KeyLifetime) {
_patch["key_lifetime"] = iPsecPolicyPatch.KeyLifetime
}
if !core.IsNil(iPsecPolicyPatch.Name) {
_patch["name"] = iPsecPolicyPatch.Name
}
if !core.IsNil(iPsecPolicyPatch.Pfs) {
_patch["pfs"] = iPsecPolicyPatch.Pfs
}
return
}
// IPsecPolicyReference : IPsecPolicyReference struct
type IPsecPolicyReference struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this IPsec policy.
Href *string `json:"href" validate:"required"`
// The unique identifier for this IPsec policy.
ID *string `json:"id" validate:"required"`
// The name for this IPsec policy. The name is unique across all IPsec policies in the region.
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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Image : Image struct
type Image struct {
// The usage constraints to match against the requested instance or bare metal server
// properties to determine compatibility.
AllowedUse *ImageAllowedUse `json:"allowed_use" validate:"required"`
CatalogOffering *ImageCatalogOffering `json:"catalog_offering" validate:"required"`
// 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 deprecation date and time (UTC) for this image.
//
// If absent, no deprecation date and time has been set.
DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"`
// 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 specified at volume creation).
//
// This property will be present for images with an `encryption` type of `user_managed`.
EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"`
// The metadata for the imported 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` or `failed`.
MinimumProvisionedSize *int64 `json:"minimum_provisioned_size,omitempty"`
// The name for this image. The name is unique across all images in the region.
Name *string `json:"name" validate:"required"`
// The obsolescence date and time (UTC) for this image.
//
// If absent, no obsolescence date and time has been set.
ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"`
// The operating system included in this image.
OperatingSystem *OperatingSystem `json:"operating_system" validate:"required"`
// If present, this property indicates that the resource associated with this reference
// is remote and therefore may not be directly retrievable.
Remote *ImageRemote `json:"remote,omitempty"`
// The resource group for this image.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The volume used to create this image (this may be
// [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)).
// If absent, this image was not created from a volume.
SourceVolume *VolumeReference `json:"source_volume,omitempty"`
// The status of this image:
// - available: image can be used to create resources
// - deleting: image is being deleted, and can no longer be used to create
// resources
// - deprecated: image is slated to be deleted, but can still be used to create
// resources
// - failed: image was not created successfully, and cannot be used to create
// resources
// - obsolete: image is slated to be deleted, and can no longer be used to create
// resources
// - pending: image is being imported, and cannot yet be used to create resources
// - unusable: image cannot be used (see `status_reasons[]` for possible remediation)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
// The reasons for the current status (if any).
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.
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.ResourceType property.
// The resource type.
const (
ImageResourceTypeImageConst = "image"
)
// Constants associated with the Image.Status property.
// The status of this image:
// - available: image can be used to create resources
// - deleting: image is being deleted, and can no longer be used to create
// resources
// - deprecated: image is slated to be deleted, but can still be used to create
// resources
// - failed: image was not created successfully, and cannot be used to create
// resources
// - obsolete: image is slated to be deleted, and can no longer be used to create
// resources
// - pending: image is being imported, and cannot yet be used to create resources
// - unusable: image cannot be used (see `status_reasons[]` for possible remediation)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ImageStatusAvailableConst = "available"
ImageStatusDeletingConst = "deleting"
ImageStatusDeprecatedConst = "deprecated"
ImageStatusFailedConst = "failed"
ImageStatusObsoleteConst = "obsolete"
ImageStatusPendingConst = "pending"
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
// - `public`: Visible to all accounts.
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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalImageAllowedUse)
if err != nil {
err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalImageCatalogOffering)
if err != nil {
err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt)
if err != nil {
err = core.SDKErrorf(err, "", "deprecation_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption)
if err != nil {
err = core.SDKErrorf(err, "", "encryption-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference)
if err != nil {
err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImageFile)
if err != nil {
err = core.SDKErrorf(err, "", "file-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "minimum_provisioned_size", &obj.MinimumProvisionedSize)
if err != nil {
err = core.SDKErrorf(err, "", "minimum_provisioned_size-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt)
if err != nil {
err = core.SDKErrorf(err, "", "obsolescence_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem)
if err != nil {
err = core.SDKErrorf(err, "", "operating_system-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalImageRemote)
if err != nil {
err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference)
if err != nil {
err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalImageStatusReason)
if err != nil {
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())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ImageAllowedUse : ImageAllowedUse struct
type ImageAllowedUse struct {
// The API version with which to evaluate the expressions.
ApiVersion *string `json:"api_version" validate:"required"`
// The expression that must be satisfied by the properties of a bare metal server provisioned using this image.
//
// The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
// but does not support built-in functions and macros. In addition, the following variables are supported,
// corresponding to `BareMetalServer` properties:
// - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
BareMetalServer *string `json:"bare_metal_server" validate:"required"`
// The expression that must be satisfied by the properties of a virtual server instance provisioned using this image.
//
// The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
// but does not support built-in functions and macros. In addition, the following variables are supported,
// corresponding to `Instance` properties:
// - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
// - `gpu.count` (integer): The number of GPUs
// - `gpu.manufacturer` (string): The GPU manufacturer
// - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes)
// - `gpu.model` (string): The GPU model.
Instance *string `json:"instance" validate:"required"`
}
// UnmarshalImageAllowedUse unmarshals an instance of ImageAllowedUse from the specified map of raw messages.
func UnmarshalImageAllowedUse(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ImageAllowedUse)
err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion)
if err != nil {
err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer)
if err != nil {
err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "instance", &obj.Instance)
if err != nil {
err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ImageAllowedUsePatch : ImageAllowedUsePatch struct
type ImageAllowedUsePatch struct {
// The API version with which to evaluate the expressions.
//
// If specified, the value must be between `2019-01-01` and today's date (in UTC).
ApiVersion *string `json:"api_version,omitempty"`
// The expression that must be satisfied by the properties of a bare metal server provisioned using this image.
//
// The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
// but does not support built-in functions and macros. In addition, the following variable is supported, corresponding
// to the `BareMetalServer` property:
// - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
BareMetalServer *string `json:"bare_metal_server,omitempty"`
// The expression that must be satisfied by the properties of a virtual server instance provisioned using this image.
//
// The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
// but does not support built-in functions and macros. In addition, the following variables are supported,
// corresponding to `Instance` properties:
// - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
// - `gpu.count` (integer): The number of GPUs
// - `gpu.manufacturer` (string): The GPU manufacturer
// - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes)
// - `gpu.model` (string): The GPU model.
Instance *string `json:"instance,omitempty"`
}
// UnmarshalImageAllowedUsePatch unmarshals an instance of ImageAllowedUsePatch from the specified map of raw messages.
func UnmarshalImageAllowedUsePatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ImageAllowedUsePatch)
err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion)
if err != nil {
err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer)
if err != nil {
err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "instance", &obj.Instance)
if err != nil {
err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the ImageAllowedUsePatch
func (imageAllowedUsePatch *ImageAllowedUsePatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(imageAllowedUsePatch.ApiVersion) {
_patch["api_version"] = imageAllowedUsePatch.ApiVersion
}
if !core.IsNil(imageAllowedUsePatch.BareMetalServer) {
_patch["bare_metal_server"] = imageAllowedUsePatch.BareMetalServer
}
if !core.IsNil(imageAllowedUsePatch.Instance) {
_patch["instance"] = imageAllowedUsePatch.Instance
}
return
}
// ImageAllowedUsePrototype : ImageAllowedUsePrototype struct
type ImageAllowedUsePrototype struct {
// The API version with which to evaluate the expressions.
//
// If specified, the value must be between `2019-01-01` and today's date (in UTC). If unspecified, the `version` query
// parameter value will be used.
ApiVersion *string `json:"api_version,omitempty"`
// The expression that must be satisfied by the properties of a bare metal server provisioned using this image.
//
// If unspecified, the expression will be set to `true`.
//
// The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
// but does not support built-in functions and macros. In addition, the following variable is supported, corresponding
// to the `BareMetalServer` property:
// - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
BareMetalServer *string `json:"bare_metal_server,omitempty"`
// The expression that must be satisfied by the properties of a virtual server instance provisioned using this image.
//
// If unspecified, the expression will be set to `true`.
//
// The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
// but does not support built-in functions and macros. In addition, the following variables are supported,
// corresponding to `Instance` properties:
// - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
// - `gpu.count` (integer): The number of GPUs
// - `gpu.manufacturer` (string): The GPU manufacturer
// - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes)
// - `gpu.model` (string): The GPU model.
Instance *string `json:"instance,omitempty"`
}
// UnmarshalImageAllowedUsePrototype unmarshals an instance of ImageAllowedUsePrototype from the specified map of raw messages.
func UnmarshalImageAllowedUsePrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ImageAllowedUsePrototype)
err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion)
if err != nil {
err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer)
if err != nil {
err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "instance", &obj.Instance)
if err != nil {
err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ImageBareMetalServerProfileCollection : ImageBareMetalServerProfileCollection struct
type ImageBareMetalServerProfileCollection struct {
// A page of bare metal server profiles compatible with the image.
BareMetalServerProfiles []BareMetalServerProfileReference `json:"bare_metal_server_profiles" validate:"required"`
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalImageBareMetalServerProfileCollection unmarshals an instance of ImageBareMetalServerProfileCollection from the specified map of raw messages.
func UnmarshalImageBareMetalServerProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ImageBareMetalServerProfileCollection)
err = core.UnmarshalModel(m, "bare_metal_server_profiles", &obj.BareMetalServerProfiles, UnmarshalBareMetalServerProfileReference)
if err != nil {
err = core.SDKErrorf(err, "", "bare_metal_server_profiles-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ImageBareMetalServerProfileCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ImageCatalogOffering : ImageCatalogOffering struct
type ImageCatalogOffering struct {
// Indicates whether this image is managed as part of a
// [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. If an image is managed,
// accounts with access to that catalog can specify the image's catalog offering version CRN to provision virtual
// server instances using the image.
Managed *bool `json:"managed" validate:"required"`
// The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user)
// offering version associated with this image.
//
// If absent, this image is not associated with a cloud catalog offering.
Version *CatalogOfferingVersionReference `json:"version,omitempty"`
}
// UnmarshalImageCatalogOffering unmarshals an instance of ImageCatalogOffering from the specified map of raw messages.
func UnmarshalImageCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ImageCatalogOffering)
err = core.UnmarshalPrimitive(m, "managed", &obj.Managed)
if err != nil {
err = core.SDKErrorf(err, "", "managed-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference)
if err != nil {
err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo())
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 *PageLink `json:"first" validate:"required"`
// A page 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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// 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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "images", &obj.Images, UnmarshalImage)
if err != nil {
err = core.SDKErrorf(err, "", "images-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ImageCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ImageExportJob : ImageExportJob struct
type ImageExportJob struct {
// The date and time that the image export job was completed.
//
// If absent, the export job has not yet completed.
CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"`
// The date and time that the image export job was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// A base64-encoded, encrypted representation of the key that was used to encrypt the data for the exported image. This
// key can be unwrapped with the image's `encryption_key` root key using either Key Protect or Hyper Protect Crypto
// Services.
//
// If absent, the export job is for an unencrypted image.
EncryptedDataKey *[]byte `json:"encrypted_data_key,omitempty"`
// The format of the exported image.
Format *string `json:"format" validate:"required"`
// The URL for this image export job.
Href *string `json:"href" validate:"required"`
// The unique identifier for this image export job.
ID *string `json:"id" validate:"required"`
// The name for this image export job. The name must not be used by another export job for the image. Changing the name
// will not affect the exported image name,
// `storage_object.name`, or `storage_href` values.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The date and time that the image export job started running.
//
// If absent, the export job has not yet started.
StartedAt *strfmt.DateTime `json:"started_at,omitempty"`
// The status of this image export job:
// - `deleting`: Export job is being deleted
// - `failed`: Export job could not be completed successfully
// - `queued`: Export job is queued
// - `running`: Export job is in progress
// - `succeeded`: Export job was completed successfully
//
// The exported image object is automatically deleted for `failed` jobs.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
// The reasons for the current status (if any).
StatusReasons []ImageExportJobStatusReason `json:"status_reasons" validate:"required"`
// The Cloud Object Storage bucket of the exported image object.
StorageBucket *CloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"`
// The Cloud Object Storage location of the exported image object. The object at this location will not exist until the
// job completes successfully. The exported image object is not managed by the IBM VPC service, and may be removed or
// replaced with a different object by any user or service with IAM authorization to the storage bucket.
StorageHref *string `json:"storage_href" validate:"required"`
// The Cloud Object Storage object for the exported image. This object will not exist until
// the job completes successfully. The exported image object is not managed by the IBM VPC
// service, and may be removed or replaced with a different object by any user or service
// with IAM authorization to the storage bucket.
StorageObject *CloudObjectStorageObjectReference `json:"storage_object" validate:"required"`
}
// Constants associated with the ImageExportJob.Format property.
// The format of the exported image.
const (
ImageExportJobFormatQcow2Const = "qcow2"
ImageExportJobFormatVhdConst = "vhd"
)
// Constants associated with the ImageExportJob.ResourceType property.
// The resource type.
const (
ImageExportJobResourceTypeImageExportJobConst = "image_export_job"
)
// Constants associated with the ImageExportJob.Status property.
// The status of this image export job:
// - `deleting`: Export job is being deleted
// - `failed`: Export job could not be completed successfully
// - `queued`: Export job is queued
// - `running`: Export job is in progress
// - `succeeded`: Export job was completed successfully
//
// The exported image object is automatically deleted for `failed` jobs.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ImageExportJobStatusDeletingConst = "deleting"
ImageExportJobStatusFailedConst = "failed"
ImageExportJobStatusQueuedConst = "queued"
ImageExportJobStatusRunningConst = "running"
ImageExportJobStatusSucceededConst = "succeeded"
)
// UnmarshalImageExportJob unmarshals an instance of ImageExportJob from the specified map of raw messages.
func UnmarshalImageExportJob(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ImageExportJob)
err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt)
if err != nil {
err = core.SDKErrorf(err, "", "completed_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey)
if err != nil {
err = core.SDKErrorf(err, "", "encrypted_data_key-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "format", &obj.Format)
if err != nil {
err = core.SDKErrorf(err, "", "format-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt)
if err != nil {
err = core.SDKErrorf(err, "", "started_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalImageExportJobStatusReason)
if err != nil {
err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "storage_bucket", &obj.StorageBucket, UnmarshalCloudObjectStorageBucketReference)
if err != nil {
err = core.SDKErrorf(err, "", "storage_bucket-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "storage_href", &obj.StorageHref)
if err != nil {
err = core.SDKErrorf(err, "", "storage_href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "storage_object", &obj.StorageObject, UnmarshalCloudObjectStorageObjectReference)
if err != nil {
err = core.SDKErrorf(err, "", "storage_object-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ImageExportJobPatch : ImageExportJobPatch struct
type ImageExportJobPatch struct {
// The name for this image export job. The name must not be used by another export job for the image. Changing the name
// will not affect the exported image name,
// `storage_object.name`, or `storage_href` values.
Name *string `json:"name,omitempty"`
}
// UnmarshalImageExportJobPatch unmarshals an instance of ImageExportJobPatch from the specified map of raw messages.
func UnmarshalImageExportJobPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ImageExportJobPatch)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the ImageExportJobPatch
func (imageExportJobPatch *ImageExportJobPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(imageExportJobPatch.Name) {
_patch["name"] = imageExportJobPatch.Name
}
return
}
// ImageExportJobStatusReason : ImageExportJobStatusReason struct
type ImageExportJobStatusReason struct {
// A snake case string succinctly identifying the status reason.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the status reason.
Message *string `json:"message" validate:"required"`
// A link to documentation about this status reason.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the ImageExportJobStatusReason.Code property.
// A snake case string succinctly identifying the status reason.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ImageExportJobStatusReasonCodeCannotAccessStorageBucketConst = "cannot_access_storage_bucket"
ImageExportJobStatusReasonCodeInternalErrorConst = "internal_error"
)
// UnmarshalImageExportJobStatusReason unmarshals an instance of ImageExportJobStatusReason from the specified map of raw messages.
func UnmarshalImageExportJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ImageExportJobStatusReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ImageExportJobUnpaginatedCollection : ImageExportJobUnpaginatedCollection struct
type ImageExportJobUnpaginatedCollection struct {
// The export jobs for the image.
ExportJobs []ImageExportJob `json:"export_jobs" validate:"required"`
}
// UnmarshalImageExportJobUnpaginatedCollection unmarshals an instance of ImageExportJobUnpaginatedCollection from the specified map of raw messages.
func UnmarshalImageExportJobUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ImageExportJobUnpaginatedCollection)
err = core.UnmarshalModel(m, "export_jobs", &obj.ExportJobs, UnmarshalImageExportJob)
if err != nil {
err = core.SDKErrorf(err, "", "export_jobs-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ImageFile : ImageFile struct
type ImageFile struct {
// The checksums for the imported 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 imported 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 {
err = core.SDKErrorf(err, "", "checksums-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "size", &obj.Size)
if err != nil {
err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ImageFileChecksums : ImageFileChecksums struct
type ImageFileChecksums struct {
// The SHA256 fingerprint of the image file, in hexadecimal.
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 {
err = core.SDKErrorf(err, "", "sha256-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ImageFilePrototype : ImageFilePrototype struct
type ImageFilePrototype struct {
// The Cloud Object Storage location of the image file.
//
// The image file format is specified by the file's extension, which must be either
// `qcow2` or `vhd`.
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")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
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 {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ImageInstanceProfileCollection : ImageInstanceProfileCollection struct
type ImageInstanceProfileCollection struct {
// A link to the first page of resources.
First *PageLink `json:"first" validate:"required"`
// A page of instance profiles compatible with the image.
InstanceProfiles []InstanceProfileReference `json:"instance_profiles" 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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalImageInstanceProfileCollection unmarshals an instance of ImageInstanceProfileCollection from the specified map of raw messages.
func UnmarshalImageInstanceProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ImageInstanceProfileCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "instance_profiles", &obj.InstanceProfiles, UnmarshalInstanceProfileReference)
if err != nil {
err = core.SDKErrorf(err, "", "instance_profiles-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ImageInstanceProfileCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ImagePatch : ImagePatch struct
type ImagePatch struct {
// The usage constraints to be matched against the requested instance or bare metal server
// properties to determine compatibility.
AllowedUse *ImageAllowedUsePatch `json:"allowed_use,omitempty"`
// The deprecation date and time to set for this image.
//
// This cannot be set if the image has a `status` of `failed` or `deleting`, or if
// `catalog_offering.managed` is `true`.
//
// The date and time must not be in the past, and must be earlier than `obsolescence_at`
// (if `obsolescence_at` is set). Additionally, if the image status is currently
// `deprecated`, the value cannot be changed (but may be removed).
//
// Specify `null` to remove an existing deprecation date and time. If the image status is currently `deprecated`, it
// will become `available`.
//
// If the deprecation date and time is reached while the image has a status of `pending`, the image's status will
// transition to `deprecated` upon its successful creation (or
// `obsolete` if the obsolescence date and time was also reached).
DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"`
// The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are
// reserved for system-provided images, and are not allowed.
Name *string `json:"name,omitempty"`
// The obsolescence date and time to set for this image.
//
// This cannot be set if the image has a `status` of `failed` or `deleting`, or if
// `catalog_offering.managed` is `true`.
//
// The date and time must not be in the past, and must be later than `deprecation_at` (if
// `deprecation_at` is set). Additionally, if the image status is currently `obsolete`, the value cannot be changed
// (but may be removed).
//
// Specify `null` to remove an existing obsolescence date and time. If the image status is currently `obsolete`, it
// will become `deprecated` if `deprecation_at` is in the past. Otherwise, it will become `available`.
//
// If the obsolescence date and time is reached while the image has a status of `pending`, the image's status will
// transition to `obsolete` upon its successful creation.
ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalImageAllowedUsePatch)
if err != nil {
err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt)
if err != nil {
err = core.SDKErrorf(err, "", "deprecation_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt)
if err != nil {
err = core.SDKErrorf(err, "", "obsolescence_at-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(imagePatch.AllowedUse) {
_patch["allowed_use"] = imagePatch.AllowedUse.asPatch()
}
if !core.IsNil(imagePatch.DeprecationAt) {
_patch["deprecation_at"] = imagePatch.DeprecationAt
}
if !core.IsNil(imagePatch.Name) {
_patch["name"] = imagePatch.Name
}
if !core.IsNil(imagePatch.ObsolescenceAt) {
_patch["obsolescence_at"] = imagePatch.ObsolescenceAt
}
return
}
// ImagePrototype : ImagePrototype struct
// Models which "extend" this model:
// - ImagePrototypeImageByFile
// - ImagePrototypeImageBySourceVolume
type ImagePrototype struct {
// The usage constraints to match against the requested instance or bare metal server
// properties to determine compatibility.
AllowedUse *ImageAllowedUsePrototype `json:"allowed_use,omitempty"`
// The deprecation date and time to set for this image.
//
// The date and time must not be in the past, and must be earlier than `obsolescence_at`
// (if `obsolescence_at` is set).
//
// If unspecified, no deprecation date and time will be set.
//
// If the deprecation date and time is reached while the image has a status of `pending`, the image's status will
// transition to `deprecated` upon its successful creation (or
// `obsolete` if the obsolescence date and time was also reached).
DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"`
// The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are
// reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of
// randomly-selected words.
Name *string `json:"name,omitempty"`
// The obsolescence date and time to set for this image.
//
// The date and time must not be in the past, and must be later than `deprecation_at` (if
// `deprecation_at` is set).
//
// If unspecified, no obsolescence date and time will be set.
//
// If the obsolescence date and time is reached while the image has a status of
// `pending`, the image's status will transition to `obsolete` upon its successful creation.
ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"`
// The resource group to use. If unspecified, the account's [default resource
// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be 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
// specified), using either [Key Protect](https://cloud.ibm.com/docs/key-protect?topic=key-protect-wrap-keys) or the
// [Hyper Protect Crypto Services](https://cloud.ibm.com/docs/services/hs-crypto?topic=hs-crypto-wrap-keys).
//
// If unspecified, the imported image is treated as unencrypted.
EncryptedDataKey *string `json:"encrypted_data_key,omitempty"`
// 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 specified at volume
// creation).
//
// If unspecified, 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 [supported operating
// system](https://cloud.ibm.com/apidocs/vpc#list-operating-systems) included in this
// image.
OperatingSystem OperatingSystemIdentityIntf `json:"operating_system,omitempty"`
// The volume from which to create the image. The specified volume must:
// - Have an `operating_system`, which will be used to populate this image's
// operating system information.
// - Not be `active` or `busy`.
//
// During image creation, the specified volume may briefly become `busy`.
SourceVolume VolumeIdentityIntf `json:"source_volume,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.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalImageAllowedUsePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt)
if err != nil {
err = core.SDKErrorf(err, "", "deprecation_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt)
if err != nil {
err = core.SDKErrorf(err, "", "obsolescence_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey)
if err != nil {
err = core.SDKErrorf(err, "", "encrypted_data_key-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImageFilePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "file-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "operating_system-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo())
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 *Deleted `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 name for this image. The name is unique across all images in the region.
Name *string `json:"name" validate:"required"`
// If present, this property indicates that the resource associated with this reference
// is remote and therefore may not be directly retrievable.
Remote *ImageRemoteContextImageReference `json:"remote,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the ImageReference.ResourceType property.
// The resource type.
const (
ImageReferenceResourceTypeImageConst = "image"
)
// 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 {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalImageRemoteContextImageReference)
if err != nil {
err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ImageRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not
// be directly retrievable.
type ImageRemote struct {
// If present, this property indicates that the referenced resource is remote to this
// account, and identifies the owning account.
Account *AccountReference `json:"account,omitempty"`
}
// UnmarshalImageRemote unmarshals an instance of ImageRemote from the specified map of raw messages.
func UnmarshalImageRemote(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ImageRemote)
err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference)
if err != nil {
err = core.SDKErrorf(err, "", "account-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ImageRemoteContextImageReference : If present, this property indicates that the resource associated with this reference is remote and therefore may not
// be directly retrievable.
type ImageRemoteContextImageReference struct {
// If present, this property indicates that the referenced resource is remote to this
// account, and identifies the owning account.
Account *AccountReference `json:"account,omitempty"`
// If present, this property indicates that the referenced resource is remote to this
// region, and identifies the native region.
Region *RegionReference `json:"region,omitempty"`
}
// UnmarshalImageRemoteContextImageReference unmarshals an instance of ImageRemoteContextImageReference from the specified map of raw messages.
func UnmarshalImageRemoteContextImageReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ImageRemoteContextImageReference)
err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference)
if err != nil {
err = core.SDKErrorf(err, "", "account-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference)
if err != nil {
err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ImageStatusReason : ImageStatusReason struct
type ImageStatusReason struct {
// A reason code for the status:
// - `encrypted_data_key_invalid`: image cannot be decrypted with the specified
// `encryption_key`
// - `encryption_key_deleted`: image unusable because its `encryption_key` was deleted
// - `encryption_key_disabled`: image unusable until its `encryption_key` is re-enabled
// - `image_data_corrupted`: image data is corrupt, or is not in the specified format
// - `image_provisioned_size_unsupported`: image requires a boot volume size greater
// than the maximum supported value
// - `image_request_in_progress`: image operation is in progress (such as an import from
// Cloud Object Storage)
// - `image_request_queued`: image request has been accepted but the requested
// operation has not started
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the status reason.
Message *string `json:"message" validate:"required"`
// A link to documentation about this status reason.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the ImageStatusReason.Code property.
// A reason code for the status:
// - `encrypted_data_key_invalid`: image cannot be decrypted with the specified
// `encryption_key`
// - `encryption_key_deleted`: image unusable because its `encryption_key` was deleted
// - `encryption_key_disabled`: image unusable until its `encryption_key` is re-enabled
// - `image_data_corrupted`: image data is corrupt, or is not in the specified format
// - `image_provisioned_size_unsupported`: image requires a boot volume size greater
// than the maximum supported value
// - `image_request_in_progress`: image operation is in progress (such as an import from
// Cloud Object Storage)
// - `image_request_queued`: image request has been accepted but the requested
// operation has not started
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ImageStatusReasonCodeEncryptedDataKeyInvalidConst = "encrypted_data_key_invalid"
ImageStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted"
ImageStatusReasonCodeEncryptionKeyDisabledConst = "encryption_key_disabled"
ImageStatusReasonCodeImageDataCorruptedConst = "image_data_corrupted"
ImageStatusReasonCodeImageProvisionedSizeUnsupportedConst = "image_provisioned_size_unsupported"
ImageStatusReasonCodeImageRequestInProgressConst = "image_request_in_progress"
ImageStatusReasonCodeImageRequestQueuedConst = "image_request_queued"
)
// 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 {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Instance : Instance struct
type Instance struct {
// The availability policy for this virtual server instance.
AvailabilityPolicy *InstanceAvailabilityPolicy `json:"availability_policy" validate:"required"`
// The total bandwidth (in megabits per second) shared across the instance network attachments or instance network
// interfaces and storage volumes of the virtual server instance.
Bandwidth *int64 `json:"bandwidth" validate:"required"`
// The boot volume attachment for this virtual server instance.
BootVolumeAttachment *VolumeAttachmentReferenceInstanceContext `json:"boot_volume_attachment" validate:"required"`
// If present, this virtual server instance was provisioned from a
// [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user).
CatalogOffering *InstanceCatalogOffering `json:"catalog_offering,omitempty"`
// If present, the cluster network that this virtual server instance resides in.
ClusterNetwork *ClusterNetworkReference `json:"cluster_network,omitempty"`
// The cluster network attachments for this virtual server instance.
//
// The cluster network attachments are ordered for consistent instance configuration.
ClusterNetworkAttachments []InstanceClusterNetworkAttachmentReference `json:"cluster_network_attachments" validate:"required"`
// The confidential compute mode for this virtual server instance.
ConfidentialComputeMode *string `json:"confidential_compute_mode" 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"`
// If present, the dedicated host this virtual server instance has been placed on.
DedicatedHost *DedicatedHostReference `json:"dedicated_host,omitempty"`
// The instance disks for this virtual server instance.
Disks []InstanceDisk `json:"disks" validate:"required"`
// Indicates whether secure boot is enabled for this virtual server instance.
EnableSecureBoot *bool `json:"enable_secure_boot" validate:"required"`
// The virtual server instance GPU configuration.
Gpu *InstanceGpu `json:"gpu,omitempty"`
// The reasons for the current `health_state` (if any).
HealthReasons []InstanceHealthReason `json:"health_reasons" validate:"required"`
// The health of this resource:
// - `ok`: No abnormal behavior detected
// - `degraded`: Experiencing 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 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 reasons for the current `lifecycle_state` (if any).
LifecycleReasons []InstanceLifecycleReason `json:"lifecycle_reasons" validate:"required"`
// The lifecycle state of the virtual server instance.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The amount of memory, truncated to whole gibibytes.
//
// The maximum limit for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Memory *int64 `json:"memory" validate:"required"`
// The metadata service configuration.
MetadataService *InstanceMetadataService `json:"metadata_service" validate:"required"`
// The name for this virtual server instance. The name is unique across all virtual server instances in the region.
Name *string `json:"name" validate:"required"`
// The network attachments for this virtual server instance, including the primary network attachment.
NetworkAttachments []InstanceNetworkAttachmentReference `json:"network_attachments" validate:"required"`
// The network interfaces for this instance, including the primary network interface.
//
// If this instance has network attachments, each network interface is a [read-only
// representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its corresponding network
// attachment and its attached virtual network interface.
NetworkInterfaces []NetworkInterfaceInstanceContextReference `json:"network_interfaces" validate:"required"`
// The number of NUMA nodes this virtual server instance is provisioned on.
//
// This property will be absent if the instance's `status` is not `running`.
NumaCount *int64 `json:"numa_count,omitempty"`
// The placement restrictions for the virtual server instance.
PlacementTarget InstancePlacementTargetIntf `json:"placement_target,omitempty"`
// The primary network attachment for this virtual server instance.
PrimaryNetworkAttachment *InstanceNetworkAttachmentReference `json:"primary_network_attachment,omitempty"`
// The primary network interface for this virtual server instance.
//
// If this instance has network attachments, this primary network interface is a
// [read-only
// representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients)
// of the primary network attachment and its attached virtual network interface.
PrimaryNetworkInterface *NetworkInterfaceInstanceContextReference `json:"primary_network_interface" validate:"required"`
// The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) for this virtual
// server instance.
Profile *InstanceProfileReference `json:"profile" validate:"required"`
// The reservation used by this virtual server instance.
//
// If absent, no reservation is in use.
Reservation *ReservationReference `json:"reservation,omitempty"`
ReservationAffinity *InstanceReservationAffinity `json:"reservation_affinity" validate:"required"`
// The resource group for this instance.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// Indicates whether the state of the virtual server instance permits a start request.
Startable *bool `json:"startable" validate:"required"`
// The status of the virtual server instance.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
// The reasons for the current status (if any).
StatusReasons []InstanceStatusReason `json:"status_reasons" validate:"required"`
// The amount of bandwidth (in megabits per second) allocated exclusively to instance network attachments or instance
// network interfaces.
TotalNetworkBandwidth *int64 `json:"total_network_bandwidth" validate:"required"`
// The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in
// this value will result in a corresponding decrease to
// `total_network_bandwidth`.
TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth" validate:"required"`
// The virtual server instance VCPU configuration.
Vcpu *InstanceVcpu `json:"vcpu" validate:"required"`
// The volume attachments for this virtual server instance, 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.ConfidentialComputeMode property.
// The confidential compute mode for this virtual server instance.
const (
InstanceConfidentialComputeModeDisabledConst = "disabled"
InstanceConfidentialComputeModeSgxConst = "sgx"
InstanceConfidentialComputeModeTdxConst = "tdx"
)
// Constants associated with the Instance.HealthState property.
// The health of this resource:
// - `ok`: No abnormal behavior detected
// - `degraded`: Experiencing 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 (
InstanceHealthStateDegradedConst = "degraded"
InstanceHealthStateFaultedConst = "faulted"
InstanceHealthStateInapplicableConst = "inapplicable"
InstanceHealthStateOkConst = "ok"
)
// Constants associated with the Instance.LifecycleState property.
// The lifecycle state of the virtual server instance.
const (
InstanceLifecycleStateDeletingConst = "deleting"
InstanceLifecycleStateFailedConst = "failed"
InstanceLifecycleStatePendingConst = "pending"
InstanceLifecycleStateStableConst = "stable"
InstanceLifecycleStateSuspendedConst = "suspended"
InstanceLifecycleStateUpdatingConst = "updating"
InstanceLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the Instance.ResourceType property.
// The resource type.
const (
InstanceResourceTypeInstanceConst = "instance"
)
// Constants associated with the Instance.Status property.
// The status of the virtual server instance.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
InstanceStatusDeletingConst = "deleting"
InstanceStatusFailedConst = "failed"
InstanceStatusPendingConst = "pending"
InstanceStatusRestartingConst = "restarting"
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.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth)
if err != nil {
err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentReferenceInstanceContext)
if err != nil {
err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOffering)
if err != nil {
err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "cluster_network", &obj.ClusterNetwork, UnmarshalClusterNetworkReference)
if err != nil {
err = core.SDKErrorf(err, "", "cluster_network-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentReference)
if err != nil {
err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode)
if err != nil {
err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "dedicated_host", &obj.DedicatedHost, UnmarshalDedicatedHostReference)
if err != nil {
err = core.SDKErrorf(err, "", "dedicated_host-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceDisk)
if err != nil {
err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot)
if err != nil {
err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "gpu", &obj.Gpu, UnmarshalInstanceGpu)
if err != nil {
err = core.SDKErrorf(err, "", "gpu-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalInstanceHealthReason)
if err != nil {
err = core.SDKErrorf(err, "", "health_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState)
if err != nil {
err = core.SDKErrorf(err, "", "health_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference)
if err != nil {
err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalInstanceLifecycleReason)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "memory", &obj.Memory)
if err != nil {
err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataService)
if err != nil {
err = core.SDKErrorf(err, "", "metadata_service-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentReference)
if err != nil {
err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceInstanceContextReference)
if err != nil {
err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "numa_count", &obj.NumaCount)
if err != nil {
err = core.SDKErrorf(err, "", "numa_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTarget)
if err != nil {
err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentReference)
if err != nil {
err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceInstanceContextReference)
if err != nil {
err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileReference)
if err != nil {
err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "reservation", &obj.Reservation, UnmarshalReservationReference)
if err != nil {
err = core.SDKErrorf(err, "", "reservation-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinity)
if err != nil {
err = core.SDKErrorf(err, "", "reservation_affinity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "startable", &obj.Startable)
if err != nil {
err = core.SDKErrorf(err, "", "startable-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalInstanceStatusReason)
if err != nil {
err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_network_bandwidth", &obj.TotalNetworkBandwidth)
if err != nil {
err = core.SDKErrorf(err, "", "total_network_bandwidth-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth)
if err != nil {
err = core.SDKErrorf(err, "", "total_volume_bandwidth-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalInstanceVcpu)
if err != nil {
err = core.SDKErrorf(err, "", "vcpu-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentReferenceInstanceContext)
if err != nil {
err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
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.
// Deprecated: this field is deprecated and may be removed in a future release.
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.
// Deprecated: this field is deprecated and may be removed in a future release.
Href *string `json:"href" validate:"required"`
// The identifier for this instance action.
// Deprecated: this field is deprecated and may be removed in a future release.
ID *string `json:"id" validate:"required"`
// The date and time that the action was started.
// Deprecated: this field is deprecated and may be removed in a future release.
StartedAt *strfmt.DateTime `json:"started_at,omitempty"`
// The current status of this action.
// Deprecated: this field is deprecated and may be removed in a future release.
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 {
err = core.SDKErrorf(err, "", "completed_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "force", &obj.Force)
if err != nil {
err = core.SDKErrorf(err, "", "force-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt)
if err != nil {
err = core.SDKErrorf(err, "", "started_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceAvailabilityPolicy : InstanceAvailabilityPolicy struct
type InstanceAvailabilityPolicy struct {
// The action to perform if the compute host experiences a failure:
// - `restart`: Automatically restart the virtual server instance after host failure
// - `stop`: Leave the virtual server instance stopped after host failure
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
HostFailure *string `json:"host_failure" validate:"required"`
}
// Constants associated with the InstanceAvailabilityPolicy.HostFailure property.
// The action to perform if the compute host experiences a failure:
// - `restart`: Automatically restart the virtual server instance after host failure
// - `stop`: Leave the virtual server instance stopped after host failure
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
InstanceAvailabilityPolicyHostFailureRestartConst = "restart"
InstanceAvailabilityPolicyHostFailureStopConst = "stop"
)
// UnmarshalInstanceAvailabilityPolicy unmarshals an instance of InstanceAvailabilityPolicy from the specified map of raw messages.
func UnmarshalInstanceAvailabilityPolicy(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceAvailabilityPolicy)
err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure)
if err != nil {
err = core.SDKErrorf(err, "", "host_failure-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceAvailabilityPolicyPatch : InstanceAvailabilityPolicyPatch struct
type InstanceAvailabilityPolicyPatch struct {
// The action to perform if the compute host experiences a failure.
// - `restart`: Automatically restart the virtual server instance after host failure
// - `stop`: Leave the virtual server instance stopped after host failure.
HostFailure *string `json:"host_failure,omitempty"`
}
// Constants associated with the InstanceAvailabilityPolicyPatch.HostFailure property.
// The action to perform if the compute host experiences a failure.
// - `restart`: Automatically restart the virtual server instance after host failure
// - `stop`: Leave the virtual server instance stopped after host failure.
const (
InstanceAvailabilityPolicyPatchHostFailureRestartConst = "restart"
InstanceAvailabilityPolicyPatchHostFailureStopConst = "stop"
)
// UnmarshalInstanceAvailabilityPolicyPatch unmarshals an instance of InstanceAvailabilityPolicyPatch from the specified map of raw messages.
func UnmarshalInstanceAvailabilityPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceAvailabilityPolicyPatch)
err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure)
if err != nil {
err = core.SDKErrorf(err, "", "host_failure-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the InstanceAvailabilityPolicyPatch
func (instanceAvailabilityPolicyPatch *InstanceAvailabilityPolicyPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(instanceAvailabilityPolicyPatch.HostFailure) {
_patch["host_failure"] = instanceAvailabilityPolicyPatch.HostFailure
}
return
}
// InstanceAvailabilityPolicyPrototype : InstanceAvailabilityPolicyPrototype struct
type InstanceAvailabilityPolicyPrototype struct {
// The action to perform if the compute host experiences a failure.
// - `restart`: Automatically restart the virtual server instance after host failure
// - `stop`: Leave the virtual server instance stopped after host failure.
HostFailure *string `json:"host_failure,omitempty"`
}
// Constants associated with the InstanceAvailabilityPolicyPrototype.HostFailure property.
// The action to perform if the compute host experiences a failure.
// - `restart`: Automatically restart the virtual server instance after host failure
// - `stop`: Leave the virtual server instance stopped after host failure.
const (
InstanceAvailabilityPolicyPrototypeHostFailureRestartConst = "restart"
InstanceAvailabilityPolicyPrototypeHostFailureStopConst = "stop"
)
// UnmarshalInstanceAvailabilityPolicyPrototype unmarshals an instance of InstanceAvailabilityPolicyPrototype from the specified map of raw messages.
func UnmarshalInstanceAvailabilityPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceAvailabilityPolicyPrototype)
err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure)
if err != nil {
err = core.SDKErrorf(err, "", "host_failure-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceCatalogOffering : InstanceCatalogOffering struct
type InstanceCatalogOffering struct {
// The billing plan used for the catalog offering version.
//
// If absent, no billing plan is in use (free).
Plan *CatalogOfferingVersionPlanReference `json:"plan,omitempty"`
// The catalog offering version this virtual server instance was provisioned from.
//
// The catalog offering version is not managed by the IBM VPC service, and may no longer
// exist, or may refer to a different image CRN than the `image.crn` for this virtual
// server instance. However, all images associated with a catalog offering version will
// have the same checksum, and therefore will have the same data.
Version *CatalogOfferingVersionReference `json:"version" validate:"required"`
}
// UnmarshalInstanceCatalogOffering unmarshals an instance of InstanceCatalogOffering from the specified map of raw messages.
func UnmarshalInstanceCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceCatalogOffering)
err = core.UnmarshalModel(m, "plan", &obj.Plan, UnmarshalCatalogOfferingVersionPlanReference)
if err != nil {
err = core.SDKErrorf(err, "", "plan-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference)
if err != nil {
err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceCatalogOfferingPrototype : The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering or offering version to use
// when provisioning this virtual server instance.
//
// If an offering is specified, the latest version of that offering will be used.
//
// The specified offering or offering version may be in a different account, subject to IAM policies.
// Models which "extend" this model:
// - InstanceCatalogOfferingPrototypeCatalogOfferingByOffering
// - InstanceCatalogOfferingPrototypeCatalogOfferingByVersion
type InstanceCatalogOfferingPrototype struct {
// The billing plan to use for the catalog offering version. If unspecified, no billing
// plan will be used (free). Must be specified for catalog offering versions that require
// a billing plan to be used.
Plan CatalogOfferingVersionPlanIdentityIntf `json:"plan,omitempty"`
// Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user)
// offering by a unique property.
Offering CatalogOfferingIdentityIntf `json:"offering,omitempty"`
// Identifies a version of a
// [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a
// unique property.
Version CatalogOfferingVersionIdentityIntf `json:"version,omitempty"`
}
func (*InstanceCatalogOfferingPrototype) isaInstanceCatalogOfferingPrototype() bool {
return true
}
type InstanceCatalogOfferingPrototypeIntf interface {
isaInstanceCatalogOfferingPrototype() bool
}
// UnmarshalInstanceCatalogOfferingPrototype unmarshals an instance of InstanceCatalogOfferingPrototype from the specified map of raw messages.
func UnmarshalInstanceCatalogOfferingPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceCatalogOfferingPrototype)
err = core.UnmarshalModel(m, "plan", &obj.Plan, UnmarshalCatalogOfferingVersionPlanIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "plan-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "offering", &obj.Offering, UnmarshalCatalogOfferingIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "offering-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceClusterNetworkAttachment : InstanceClusterNetworkAttachment struct
type InstanceClusterNetworkAttachment struct {
// The instance cluster network attachment that is immediately before. If absent, this is the
// last instance cluster network attachment.
Before *InstanceClusterNetworkAttachmentBefore `json:"before,omitempty"`
// The cluster network interface for this instance cluster network attachment.
ClusterNetworkInterface *ClusterNetworkInterfaceReference `json:"cluster_network_interface" validate:"required"`
// The URL for this instance cluster network attachment.
Href *string `json:"href" validate:"required"`
// The unique identifier for this instance cluster network attachment.
ID *string `json:"id" validate:"required"`
// The reasons for the current `lifecycle_state` (if any).
LifecycleReasons []InstanceClusterNetworkAttachmentLifecycleReason `json:"lifecycle_reasons" validate:"required"`
// The lifecycle state of the instance cluster network attachment.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The name for this instance cluster network attachment. The name is unique across all network attachments for the
// instance.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the InstanceClusterNetworkAttachment.LifecycleState property.
// The lifecycle state of the instance cluster network attachment.
const (
InstanceClusterNetworkAttachmentLifecycleStateDeletingConst = "deleting"
InstanceClusterNetworkAttachmentLifecycleStateFailedConst = "failed"
InstanceClusterNetworkAttachmentLifecycleStatePendingConst = "pending"
InstanceClusterNetworkAttachmentLifecycleStateStableConst = "stable"
InstanceClusterNetworkAttachmentLifecycleStateSuspendedConst = "suspended"
InstanceClusterNetworkAttachmentLifecycleStateUpdatingConst = "updating"
InstanceClusterNetworkAttachmentLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the InstanceClusterNetworkAttachment.ResourceType property.
// The resource type.
const (
InstanceClusterNetworkAttachmentResourceTypeInstanceClusterNetworkAttachmentConst = "instance_cluster_network_attachment"
)
// UnmarshalInstanceClusterNetworkAttachment unmarshals an instance of InstanceClusterNetworkAttachment from the specified map of raw messages.
func UnmarshalInstanceClusterNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceClusterNetworkAttachment)
err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalInstanceClusterNetworkAttachmentBefore)
if err != nil {
err = core.SDKErrorf(err, "", "before-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "cluster_network_interface", &obj.ClusterNetworkInterface, UnmarshalClusterNetworkInterfaceReference)
if err != nil {
err = core.SDKErrorf(err, "", "cluster_network_interface-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalInstanceClusterNetworkAttachmentLifecycleReason)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceClusterNetworkAttachmentBefore : The instance cluster network attachment that is immediately before. If absent, this is the last instance cluster
// network attachment.
type InstanceClusterNetworkAttachmentBefore struct {
// The URL for this instance cluster network attachment.
Href *string `json:"href" validate:"required"`
// The unique identifier for this instance cluster network attachment.
ID *string `json:"id" validate:"required"`
// The name for this instance cluster network attachment. The name is unique across all network attachments for the
// instance.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the InstanceClusterNetworkAttachmentBefore.ResourceType property.
// The resource type.
const (
InstanceClusterNetworkAttachmentBeforeResourceTypeInstanceClusterNetworkAttachmentConst = "instance_cluster_network_attachment"
)
// UnmarshalInstanceClusterNetworkAttachmentBefore unmarshals an instance of InstanceClusterNetworkAttachmentBefore from the specified map of raw messages.
func UnmarshalInstanceClusterNetworkAttachmentBefore(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceClusterNetworkAttachmentBefore)
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceClusterNetworkAttachmentBeforePrototype : The instance cluster network attachment to insert this instance cluster network attachment immediately before.
//
// If unspecified, this instance cluster network attachment will be inserted after all existing instance cluster network
// attachments.
// Models which "extend" this model:
// - InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByID
// - InstanceClusterNetworkAttachmentBeforePrototypeInstanceClusterNetworkAttachmentIdentityByHref
type InstanceClusterNetworkAttachmentBeforePrototype struct {
// The unique identifier for this instance cluster network attachment.
ID *string `json:"id,omitempty"`
// The URL for this instance cluster network attachment.
Href *string `json:"href,omitempty"`
}
func (*InstanceClusterNetworkAttachmentBeforePrototype) isaInstanceClusterNetworkAttachmentBeforePrototype() bool {
return true
}
type InstanceClusterNetworkAttachmentBeforePrototypeIntf interface {
isaInstanceClusterNetworkAttachmentBeforePrototype() bool
}
// UnmarshalInstanceClusterNetworkAttachmentBeforePrototype unmarshals an instance of InstanceClusterNetworkAttachmentBeforePrototype from the specified map of raw messages.
func UnmarshalInstanceClusterNetworkAttachmentBeforePrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceClusterNetworkAttachmentBeforePrototype)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceClusterNetworkAttachmentCollection : InstanceClusterNetworkAttachmentCollection struct
type InstanceClusterNetworkAttachmentCollection struct {
// A page of ordered cluster network attachments (sorted based on the `before` property) for the instance. A cluster
// network attachment represents a device to which a cluster network interface is attached.
ClusterNetworkAttachments []InstanceClusterNetworkAttachment `json:"cluster_network_attachments" validate:"required"`
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalInstanceClusterNetworkAttachmentCollection unmarshals an instance of InstanceClusterNetworkAttachmentCollection from the specified map of raw messages.
func UnmarshalInstanceClusterNetworkAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceClusterNetworkAttachmentCollection)
err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachment)
if err != nil {
err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *InstanceClusterNetworkAttachmentCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// InstanceClusterNetworkAttachmentLifecycleReason : InstanceClusterNetworkAttachmentLifecycleReason struct
type InstanceClusterNetworkAttachmentLifecycleReason struct {
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this lifecycle state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this lifecycle state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the InstanceClusterNetworkAttachmentLifecycleReason.Code property.
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
InstanceClusterNetworkAttachmentLifecycleReasonCodeInternalErrorConst = "internal_error"
InstanceClusterNetworkAttachmentLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider"
)
// UnmarshalInstanceClusterNetworkAttachmentLifecycleReason unmarshals an instance of InstanceClusterNetworkAttachmentLifecycleReason from the specified map of raw messages.
func UnmarshalInstanceClusterNetworkAttachmentLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceClusterNetworkAttachmentLifecycleReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceClusterNetworkAttachmentPatch : InstanceClusterNetworkAttachmentPatch struct
type InstanceClusterNetworkAttachmentPatch struct {
// The name for this network attachment. The name must not be used by another network attachment for the instance.
// Names starting with `ibm-` are reserved for provider-owned resources, and are not allowed.
Name *string `json:"name,omitempty"`
}
// UnmarshalInstanceClusterNetworkAttachmentPatch unmarshals an instance of InstanceClusterNetworkAttachmentPatch from the specified map of raw messages.
func UnmarshalInstanceClusterNetworkAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceClusterNetworkAttachmentPatch)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the InstanceClusterNetworkAttachmentPatch
func (instanceClusterNetworkAttachmentPatch *InstanceClusterNetworkAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(instanceClusterNetworkAttachmentPatch.Name) {
_patch["name"] = instanceClusterNetworkAttachmentPatch.Name
}
return
}
// InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface : A cluster network interface for the instance cluster network attachment. This can be specified using an existing
// cluster network interface that does not already have a
// `target`, or a prototype object for a new cluster network interface.
//
// This instance must reside in the same VPC as the specified cluster network interface. The cluster network interface
// must reside in the same cluster network as the
// `cluster_network_interface` of any other `cluster_network_attachments` for this instance.
// Models which "extend" this model:
// - InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceInstanceClusterNetworkInterfacePrototypeInstanceClusterNetworkAttachment
// - InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceClusterNetworkInterfaceIdentity
type InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface struct {
// Indicates whether this cluster network interface will be automatically deleted when `target` is deleted.
AutoDelete *bool `json:"auto_delete,omitempty"`
// The name for this cluster network interface. The name must not be used by another interface in the cluster network.
// Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name
// will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The primary IP address to bind to the cluster network interface. May be either
// a cluster network subnet reserved IP identity, or a cluster network subnet reserved IP
// prototype object which will be used to create a new cluster network subnet reserved IP.
//
// If a cluster network subnet reserved IP identity is provided, the specified cluster
// network subnet reserved IP must be unbound.
//
// If a cluster network subnet reserved IP prototype object with an address is provided,
// the address must be available on the cluster network interface's cluster network
// subnet. If no address is specified, an available address on the cluster network subnet
// will be automatically selected and reserved.
PrimaryIP ClusterNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"`
// The associated cluster network subnet. Required if `primary_ip` does not specify a
// cluster network subnet reserved IP identity.
Subnet ClusterNetworkSubnetIdentityIntf `json:"subnet,omitempty"`
// The unique identifier for this cluster network interface.
ID *string `json:"id,omitempty"`
// The URL for this cluster network interface.
Href *string `json:"href,omitempty"`
}
func (*InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface) isaInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface() bool {
return true
}
type InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceIntf interface {
isaInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface() bool
}
// UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface unmarshals an instance of InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface from the specified map of raw messages.
func UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface)
err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalClusterNetworkInterfacePrimaryIPPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalClusterNetworkSubnetIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceClusterNetworkAttachmentPrototypeInstanceContext : InstanceClusterNetworkAttachmentPrototypeInstanceContext struct
type InstanceClusterNetworkAttachmentPrototypeInstanceContext struct {
// A cluster network interface for the instance cluster network attachment. This can be
// specified using an existing cluster network interface that does not already have a
// `target`, or a prototype object for a new cluster network interface.
//
// This instance must reside in the same VPC as the specified cluster network interface. The
// cluster network interface must reside in the same cluster network as the
// `cluster_network_interface` of any other `cluster_network_attachments` for this instance.
ClusterNetworkInterface InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceIntf `json:"cluster_network_interface" validate:"required"`
// The name for this cluster network attachment. Names must be unique within the instance the cluster network
// attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. Names starting
// with `ibm-` are reserved for provider-owned resources, and are not allowed.
Name *string `json:"name,omitempty"`
}
// NewInstanceClusterNetworkAttachmentPrototypeInstanceContext : Instantiate InstanceClusterNetworkAttachmentPrototypeInstanceContext (Generic Model Constructor)
func (*VpcV1) NewInstanceClusterNetworkAttachmentPrototypeInstanceContext(clusterNetworkInterface InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterfaceIntf) (_model *InstanceClusterNetworkAttachmentPrototypeInstanceContext, err error) {
_model = &InstanceClusterNetworkAttachmentPrototypeInstanceContext{
ClusterNetworkInterface: clusterNetworkInterface,
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext unmarshals an instance of InstanceClusterNetworkAttachmentPrototypeInstanceContext from the specified map of raw messages.
func UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceClusterNetworkAttachmentPrototypeInstanceContext)
err = core.UnmarshalModel(m, "cluster_network_interface", &obj.ClusterNetworkInterface, UnmarshalInstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface)
if err != nil {
err = core.SDKErrorf(err, "", "cluster_network_interface-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceClusterNetworkAttachmentReference : InstanceClusterNetworkAttachmentReference struct
type InstanceClusterNetworkAttachmentReference struct {
// The URL for this instance cluster network attachment.
Href *string `json:"href" validate:"required"`
// The unique identifier for this instance cluster network attachment.
ID *string `json:"id" validate:"required"`
// The name for this instance cluster network attachment. The name is unique across all network attachments for the
// instance.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the InstanceClusterNetworkAttachmentReference.ResourceType property.
// The resource type.
const (
InstanceClusterNetworkAttachmentReferenceResourceTypeInstanceClusterNetworkAttachmentConst = "instance_cluster_network_attachment"
)
// UnmarshalInstanceClusterNetworkAttachmentReference unmarshals an instance of InstanceClusterNetworkAttachmentReference from the specified map of raw messages.
func UnmarshalInstanceClusterNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceClusterNetworkAttachmentReference)
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
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 *PageLink `json:"first" validate:"required"`
// A page 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 *PageLink `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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "instances", &obj.Instances, UnmarshalInstance)
if err != nil {
err = core.SDKErrorf(err, "", "instances-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *InstanceCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// 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 {
err = core.SDKErrorf(err, "", "access_token-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType)
if err != nil {
err = core.SDKErrorf(err, "", "console_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "expires_at", &obj.ExpiresAt)
if err != nil {
err = core.SDKErrorf(err, "", "expires_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "force", &obj.Force)
if err != nil {
err = core.SDKErrorf(err, "", "force-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceDefaultTrustedProfilePrototype : InstanceDefaultTrustedProfilePrototype struct
type InstanceDefaultTrustedProfilePrototype struct {
// If set to `true`, the system will create a link to the specified `target` trusted profile during instance creation.
// Regardless of whether a link is created by the system or manually using the IAM Identity service, it will be
// automatically deleted when the instance is deleted.
AutoLink *bool `json:"auto_link,omitempty"`
// The default IAM trusted profile to use for this virtual server instance.
Target TrustedProfileIdentityIntf `json:"target" validate:"required"`
}
// NewInstanceDefaultTrustedProfilePrototype : Instantiate InstanceDefaultTrustedProfilePrototype (Generic Model Constructor)
func (*VpcV1) NewInstanceDefaultTrustedProfilePrototype(target TrustedProfileIdentityIntf) (_model *InstanceDefaultTrustedProfilePrototype, err error) {
_model = &InstanceDefaultTrustedProfilePrototype{
Target: target,
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalInstanceDefaultTrustedProfilePrototype unmarshals an instance of InstanceDefaultTrustedProfilePrototype from the specified map of raw messages.
func UnmarshalInstanceDefaultTrustedProfilePrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceDefaultTrustedProfilePrototype)
err = core.UnmarshalPrimitive(m, "auto_link", &obj.AutoLink)
if err != nil {
err = core.SDKErrorf(err, "", "auto_link-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalTrustedProfileIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
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 may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
InterfaceType *string `json:"interface_type" validate:"required"`
// The name for this instance disk. The name is unique across all disks on the instance.
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 may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType)
if err != nil {
err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "size", &obj.Size)
if err != nil {
err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceDiskCollection : InstanceDiskCollection struct
type InstanceDiskCollection struct {
// The disks for the instance.
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 {
err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceDiskPatch : InstanceDiskPatch struct
type InstanceDiskPatch struct {
// The name for this instance disk. The name must not be used by another disk on the instance.
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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(instanceDiskPatch.Name) {
_patch["name"] = instanceDiskPatch.Name
}
return
}
// InstanceDiskReference : InstanceDiskReference struct
type InstanceDiskReference struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `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 name for this instance disk. The name is unique across all disks on the instance.
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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
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.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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"`
}
// Constants associated with the InstanceGpu.Manufacturer property.
// The GPU manufacturer.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
InstanceGpuManufacturerAmdConst = "amd"
InstanceGpuManufacturerIntelConst = "intel"
InstanceGpuManufacturerNvidiaConst = "nvidia"
)
// 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 {
err = core.SDKErrorf(err, "", "count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer)
if err != nil {
err = core.SDKErrorf(err, "", "manufacturer-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "memory", &obj.Memory)
if err != nil {
err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "model", &obj.Model)
if err != nil {
err = core.SDKErrorf(err, "", "model-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceGroup : InstanceGroup struct
type InstanceGroup struct {
// The port used for new load balancer pool members created by this instance group.
//
// This property will be present if and only if `load_balancer_pool` is present.
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 reasons for the current `lifecycle_state` (if any).
LifecycleReasons []InstanceGroupLifecycleReason `json:"lifecycle_reasons" validate:"required"`
// The lifecycle state of the instance group.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// If present, the load balancer pool this instance group manages. A pool member will
// be created for each instance created by this group.
LoadBalancerPool *LoadBalancerPoolReference `json:"load_balancer_pool,omitempty"`
// The 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 name for this instance group. The name is unique across all instance groups in the region.
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
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
// The subnets to use when creating new instances.
Subnets []SubnetReference `json:"subnets" validate:"required"`
// The date and time that the instance group was updated.
UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"`
// The VPC the instance group resides in.
VPC *VPCReference `json:"vpc" validate:"required"`
}
// Constants associated with the InstanceGroup.LifecycleState property.
// The lifecycle state of the instance group.
const (
InstanceGroupLifecycleStateDeletingConst = "deleting"
InstanceGroupLifecycleStateFailedConst = "failed"
InstanceGroupLifecycleStatePendingConst = "pending"
InstanceGroupLifecycleStateStableConst = "stable"
InstanceGroupLifecycleStateSuspendedConst = "suspended"
InstanceGroupLifecycleStateUpdatingConst = "updating"
InstanceGroupLifecycleStateWaitingConst = "waiting"
)
// 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
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 {
err = core.SDKErrorf(err, "", "application_port-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference)
if err != nil {
err = core.SDKErrorf(err, "", "instance_template-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalInstanceGroupLifecycleReason)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolReference)
if err != nil {
err = core.SDKErrorf(err, "", "load_balancer_pool-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "managers", &obj.Managers, UnmarshalInstanceGroupManagerReference)
if err != nil {
err = core.SDKErrorf(err, "", "managers-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount)
if err != nil {
err = core.SDKErrorf(err, "", "membership_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
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 *PageLink `json:"first" validate:"required"`
// A page 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 *PageLink `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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "instance_groups", &obj.InstanceGroups, UnmarshalInstanceGroup)
if err != nil {
err = core.SDKErrorf(err, "", "instance_groups-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *InstanceGroupCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// InstanceGroupLifecycleReason : InstanceGroupLifecycleReason struct
type InstanceGroupLifecycleReason struct {
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this lifecycle state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this lifecycle state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the InstanceGroupLifecycleReason.Code property.
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
InstanceGroupLifecycleReasonCodeInternalErrorConst = "internal_error"
InstanceGroupLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider"
)
// UnmarshalInstanceGroupLifecycleReason unmarshals an instance of InstanceGroupLifecycleReason from the specified map of raw messages.
func UnmarshalInstanceGroupLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceGroupLifecycleReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceGroupManager : InstanceGroupManager struct
// Models which "extend" this model:
// - InstanceGroupManagerAutoScale
// - InstanceGroupManagerScheduled
type InstanceGroupManager struct {
// The date and time that the instance group manager was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// 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"`
// Indicates whether this manager will control the instance group.
ManagementEnabled *bool `json:"management_enabled" validate:"required"`
// The name for this instance group manager. The name is unique across all managers for the instance group.
Name *string `json:"name" validate:"required"`
// The date and time that the instance group manager was updated.
UpdatedAt *strfmt.DateTime `json:"updated_at" 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"`
// The actions of the instance group manager.
Actions []InstanceGroupManagerActionReference `json:"actions,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, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled)
if err != nil {
err = core.SDKErrorf(err, "", "management_enabled-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow)
if err != nil {
err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown)
if err != nil {
err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType)
if err != nil {
err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount)
if err != nil {
err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount)
if err != nil {
err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicyReference)
if err != nil {
err = core.SDKErrorf(err, "", "policies-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerActionReference)
if err != nil {
err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceGroupManagerAction : InstanceGroupManagerAction struct
// Models which "extend" this model:
// - InstanceGroupManagerActionScheduledAction
type InstanceGroupManagerAction struct {
// Indicates whether this scheduled action will be automatically deleted after it has completed and
// `auto_delete_timeout` hours have passed.
AutoDelete *bool `json:"auto_delete" validate:"required"`
// If `auto_delete` is `true`, and this scheduled action has finished, the hours after which it will be automatically
// deleted. If the value is `0`, the action will be deleted once it has finished.
AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"`
// The date and time that the instance group manager action was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The URL for this instance group manager action.
Href *string `json:"href" validate:"required"`
// The unique identifier for this instance group manager action.
ID *string `json:"id" validate:"required"`
// The name for this instance group manager action. The name is unique across all actions for the instance group
// manager.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The status of the instance group action
// - `active`: Action is ready to be run
// - `completed`: Action was completed successfully
// - `failed`: Action could not be completed successfully
// - `incompatible`: Action parameters are not compatible with the group or manager
// - `omitted`: Action was not applied because this action's manager was disabled
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
// The date and time that the instance group manager action was updated.
UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"`
// The type of action for the instance group.
ActionType *string `json:"action_type,omitempty"`
// The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min
// period.
CronSpec *string `json:"cron_spec,omitempty"`
// The date and time the scheduled action was last applied. If absent, the action has never been applied.
LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"`
// The date and time the scheduled action will next run. If absent, the system is currently calculating the next run
// time.
NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"`
Group *InstanceGroupManagerScheduledActionGroup `json:"group,omitempty"`
Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager,omitempty"`
}
// Constants associated with the InstanceGroupManagerAction.ResourceType property.
// The resource type.
const (
InstanceGroupManagerActionResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action"
)
// Constants associated with the InstanceGroupManagerAction.Status property.
// The status of the instance group action
// - `active`: Action is ready to be run
// - `completed`: Action was completed successfully
// - `failed`: Action could not be completed successfully
// - `incompatible`: Action parameters are not compatible with the group or manager
// - `omitted`: Action was not applied because this action's manager was disabled
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
InstanceGroupManagerActionStatusActiveConst = "active"
InstanceGroupManagerActionStatusCompletedConst = "completed"
InstanceGroupManagerActionStatusFailedConst = "failed"
InstanceGroupManagerActionStatusIncompatibleConst = "incompatible"
InstanceGroupManagerActionStatusOmittedConst = "omitted"
)
// Constants associated with the InstanceGroupManagerAction.ActionType property.
// The type of action for the instance group.
const (
InstanceGroupManagerActionActionTypeScheduledConst = "scheduled"
)
func (*InstanceGroupManagerAction) isaInstanceGroupManagerAction() bool {
return true
}
type InstanceGroupManagerActionIntf interface {
isaInstanceGroupManagerAction() bool
}
// UnmarshalInstanceGroupManagerAction unmarshals an instance of InstanceGroupManagerAction from the specified map of raw messages.
func UnmarshalInstanceGroupManagerAction(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceGroupManagerAction)
err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete_timeout-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType)
if err != nil {
err = core.SDKErrorf(err, "", "action_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec)
if err != nil {
err = core.SDKErrorf(err, "", "cron_spec-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt)
if err != nil {
err = core.SDKErrorf(err, "", "last_applied_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt)
if err != nil {
err = core.SDKErrorf(err, "", "next_run_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup)
if err != nil {
err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager)
if err != nil {
err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceGroupManagerActionGroupPatch : InstanceGroupManagerActionGroupPatch struct
type InstanceGroupManagerActionGroupPatch struct {
// The desired number of instance group members at the scheduled time.
MembershipCount *int64 `json:"membership_count,omitempty"`
}
// UnmarshalInstanceGroupManagerActionGroupPatch unmarshals an instance of InstanceGroupManagerActionGroupPatch from the specified map of raw messages.
func UnmarshalInstanceGroupManagerActionGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceGroupManagerActionGroupPatch)
err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount)
if err != nil {
err = core.SDKErrorf(err, "", "membership_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the InstanceGroupManagerActionGroupPatch
func (instanceGroupManagerActionGroupPatch *InstanceGroupManagerActionGroupPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(instanceGroupManagerActionGroupPatch.MembershipCount) {
_patch["membership_count"] = instanceGroupManagerActionGroupPatch.MembershipCount
}
return
}
// InstanceGroupManagerActionManagerPatch : InstanceGroupManagerActionManagerPatch struct
type InstanceGroupManagerActionManagerPatch struct {
// The desired maximum number of instance group members at the scheduled time.
MaxMembershipCount *int64 `json:"max_membership_count,omitempty"`
// The desired minimum number of instance group members at the scheduled time.
MinMembershipCount *int64 `json:"min_membership_count,omitempty"`
}
// UnmarshalInstanceGroupManagerActionManagerPatch unmarshals an instance of InstanceGroupManagerActionManagerPatch from the specified map of raw messages.
func UnmarshalInstanceGroupManagerActionManagerPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceGroupManagerActionManagerPatch)
err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount)
if err != nil {
err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount)
if err != nil {
err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the InstanceGroupManagerActionManagerPatch
func (instanceGroupManagerActionManagerPatch *InstanceGroupManagerActionManagerPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(instanceGroupManagerActionManagerPatch.MaxMembershipCount) {
_patch["max_membership_count"] = instanceGroupManagerActionManagerPatch.MaxMembershipCount
}
if !core.IsNil(instanceGroupManagerActionManagerPatch.MinMembershipCount) {
_patch["min_membership_count"] = instanceGroupManagerActionManagerPatch.MinMembershipCount
}
return
}
// InstanceGroupManagerActionPatch : InstanceGroupManagerActionPatch struct
type InstanceGroupManagerActionPatch struct {
// Indicates whether this scheduled action will be automatically deleted after it has completed and
// `auto_delete_timeout` hours have passed.
AutoDelete *bool `json:"auto_delete,omitempty"`
// If `auto_delete` is `true`, and this scheduled action has finished, the hours after which it will be automatically
// deleted. If the value is `0`, the action will be deleted once it has finished.
AutoDeleteTimeout *int64 `json:"auto_delete_timeout,omitempty"`
// The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min
// period.
CronSpec *string `json:"cron_spec,omitempty"`
Group *InstanceGroupManagerActionGroupPatch `json:"group,omitempty"`
Manager *InstanceGroupManagerActionManagerPatch `json:"manager,omitempty"`
// The name for this instance group manager action. The name must not be used by another action for the instance group
// manager.
Name *string `json:"name,omitempty"`
// The date and time the scheduled action will run.
RunAt *strfmt.DateTime `json:"run_at,omitempty"`
}
// UnmarshalInstanceGroupManagerActionPatch unmarshals an instance of InstanceGroupManagerActionPatch from the specified map of raw messages.
func UnmarshalInstanceGroupManagerActionPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceGroupManagerActionPatch)
err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete_timeout-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec)
if err != nil {
err = core.SDKErrorf(err, "", "cron_spec-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerActionGroupPatch)
if err != nil {
err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerActionManagerPatch)
if err != nil {
err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt)
if err != nil {
err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the InstanceGroupManagerActionPatch
func (instanceGroupManagerActionPatch *InstanceGroupManagerActionPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(instanceGroupManagerActionPatch.AutoDelete) {
_patch["auto_delete"] = instanceGroupManagerActionPatch.AutoDelete
}
if !core.IsNil(instanceGroupManagerActionPatch.AutoDeleteTimeout) {
_patch["auto_delete_timeout"] = instanceGroupManagerActionPatch.AutoDeleteTimeout
}
if !core.IsNil(instanceGroupManagerActionPatch.CronSpec) {
_patch["cron_spec"] = instanceGroupManagerActionPatch.CronSpec
}
if !core.IsNil(instanceGroupManagerActionPatch.Group) {
_patch["group"] = instanceGroupManagerActionPatch.Group.asPatch()
}
if !core.IsNil(instanceGroupManagerActionPatch.Manager) {
_patch["manager"] = instanceGroupManagerActionPatch.Manager.asPatch()
}
if !core.IsNil(instanceGroupManagerActionPatch.Name) {
_patch["name"] = instanceGroupManagerActionPatch.Name
}
if !core.IsNil(instanceGroupManagerActionPatch.RunAt) {
_patch["run_at"] = instanceGroupManagerActionPatch.RunAt
}
return
}
// InstanceGroupManagerActionPrototype : InstanceGroupManagerActionPrototype struct
// Models which "extend" this model:
// - InstanceGroupManagerActionPrototypeScheduledActionPrototype
type InstanceGroupManagerActionPrototype struct {
// The name for this instance group manager action. The name must not be used by another action for the instance group
// manager. If unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The date and time the scheduled action will run.
RunAt *strfmt.DateTime `json:"run_at,omitempty"`
Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"`
Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"`
// The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min
// period.
CronSpec *string `json:"cron_spec,omitempty"`
}
func (*InstanceGroupManagerActionPrototype) isaInstanceGroupManagerActionPrototype() bool {
return true
}
type InstanceGroupManagerActionPrototypeIntf interface {
isaInstanceGroupManagerActionPrototype() bool
}
// UnmarshalInstanceGroupManagerActionPrototype unmarshals an instance of InstanceGroupManagerActionPrototype from the specified map of raw messages.
func UnmarshalInstanceGroupManagerActionPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceGroupManagerActionPrototype)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt)
if err != nil {
err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec)
if err != nil {
err = core.SDKErrorf(err, "", "cron_spec-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceGroupManagerActionReference : InstanceGroupManagerActionReference struct
type InstanceGroupManagerActionReference struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this instance group manager action.
Href *string `json:"href" validate:"required"`
// The unique identifier for this instance group manager action.
ID *string `json:"id" validate:"required"`
// The name for this instance group manager action. The name is unique across all actions for the instance group
// manager.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the InstanceGroupManagerActionReference.ResourceType property.
// The resource type.
const (
InstanceGroupManagerActionReferenceResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action"
)
// UnmarshalInstanceGroupManagerActionReference unmarshals an instance of InstanceGroupManagerActionReference from the specified map of raw messages.
func UnmarshalInstanceGroupManagerActionReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceGroupManagerActionReference)
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceGroupManagerActionsCollection : InstanceGroupManagerActionsCollection struct
type InstanceGroupManagerActionsCollection struct {
// A page of actions for the instance group manager.
Actions []InstanceGroupManagerActionIntf `json:"actions" validate:"required"`
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalInstanceGroupManagerActionsCollection unmarshals an instance of InstanceGroupManagerActionsCollection from the specified map of raw messages.
func UnmarshalInstanceGroupManagerActionsCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceGroupManagerActionsCollection)
err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerAction)
if err != nil {
err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *InstanceGroupManagerActionsCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// InstanceGroupManagerCollection : InstanceGroupManagerCollection struct
type InstanceGroupManagerCollection struct {
// A link to the first page of resources.
First *PageLink `json:"first" validate:"required"`
// The maximum number of resources that can be returned by the request.
Limit *int64 `json:"limit" validate:"required"`
// A page of managers for the instance group.
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 *PageLink `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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "managers", &obj.Managers, UnmarshalInstanceGroupManager)
if err != nil {
err = core.SDKErrorf(err, "", "managers-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *InstanceGroupManagerCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// 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"`
// Indicates whether 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 name for this instance group manager. The name must not be used by another manager for 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 {
err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown)
if err != nil {
err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled)
if err != nil {
err = core.SDKErrorf(err, "", "management_enabled-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount)
if err != nil {
err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount)
if err != nil {
err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(instanceGroupManagerPatch.AggregationWindow) {
_patch["aggregation_window"] = instanceGroupManagerPatch.AggregationWindow
}
if !core.IsNil(instanceGroupManagerPatch.Cooldown) {
_patch["cooldown"] = instanceGroupManagerPatch.Cooldown
}
if !core.IsNil(instanceGroupManagerPatch.ManagementEnabled) {
_patch["management_enabled"] = instanceGroupManagerPatch.ManagementEnabled
}
if !core.IsNil(instanceGroupManagerPatch.MaxMembershipCount) {
_patch["max_membership_count"] = instanceGroupManagerPatch.MaxMembershipCount
}
if !core.IsNil(instanceGroupManagerPatch.MinMembershipCount) {
_patch["min_membership_count"] = instanceGroupManagerPatch.MinMembershipCount
}
if !core.IsNil(instanceGroupManagerPatch.Name) {
_patch["name"] = instanceGroupManagerPatch.Name
}
return
}
// InstanceGroupManagerPolicy : InstanceGroupManagerPolicy struct
// Models which "extend" this model:
// - InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy
type InstanceGroupManagerPolicy struct {
// The date and time that the instance group manager policy was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// 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 name for this instance group manager policy. The name is unique across all policies for the instance group
// manager.
Name *string `json:"name" validate:"required"`
// The date and time that the instance group manager policy was updated.
UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"`
// The type of metric to be evaluated
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
PolicyType *string `json:"policy_type,omitempty"`
}
// Constants associated with the InstanceGroupManagerPolicy.MetricType property.
// The type of metric to be evaluated
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType)
if err != nil {
err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue)
if err != nil {
err = core.SDKErrorf(err, "", "metric_value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType)
if err != nil {
err = core.SDKErrorf(err, "", "policy_type-error", common.GetComponentInfo())
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 *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of policies for the instance group manager.
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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "policies-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *InstanceGroupManagerPolicyCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// 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 name for this instance group manager policy. The name must not be used by another policy for 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 {
err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue)
if err != nil {
err = core.SDKErrorf(err, "", "metric_value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(instanceGroupManagerPolicyPatch.MetricType) {
_patch["metric_type"] = instanceGroupManagerPolicyPatch.MetricType
}
if !core.IsNil(instanceGroupManagerPolicyPatch.MetricValue) {
_patch["metric_value"] = instanceGroupManagerPolicyPatch.MetricValue
}
if !core.IsNil(instanceGroupManagerPolicyPatch.Name) {
_patch["name"] = instanceGroupManagerPolicyPatch.Name
}
return
}
// InstanceGroupManagerPolicyPrototype : InstanceGroupManagerPolicyPrototype struct
// Models which "extend" this model:
// - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype
type InstanceGroupManagerPolicyPrototype struct {
// The name for this instance group manager policy. The name must not be used by another policy for the instance group
// manager. If unspecified, the name will be a hyphenated list of randomly-selected words.
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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType)
if err != nil {
err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue)
if err != nil {
err = core.SDKErrorf(err, "", "metric_value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType)
if err != nil {
err = core.SDKErrorf(err, "", "policy_type-error", common.GetComponentInfo())
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 *Deleted `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 name for this instance group manager policy. The name is unique across all policies for 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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceGroupManagerPrototype : InstanceGroupManagerPrototype struct
// Models which "extend" this model:
// - InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype
// - InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype
type InstanceGroupManagerPrototype struct {
// Indicates whether this manager will control the instance group.
ManagementEnabled *bool `json:"management_enabled,omitempty"`
// The name for this instance group manager. The name must not be used by another manager for the instance group. If
// unspecified, the name will be a hyphenated list of randomly-selected words.
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 {
err = core.SDKErrorf(err, "", "management_enabled-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow)
if err != nil {
err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown)
if err != nil {
err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType)
if err != nil {
err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount)
if err != nil {
err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount)
if err != nil {
err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo())
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 *Deleted `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 name for this instance group manager. The name is unique across all managers for 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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceGroupManagerScheduledActionGroup : InstanceGroupManagerScheduledActionGroup struct
type InstanceGroupManagerScheduledActionGroup struct {
// The desired number of instance group members at the scheduled time.
MembershipCount *int64 `json:"membership_count" validate:"required"`
}
// UnmarshalInstanceGroupManagerScheduledActionGroup unmarshals an instance of InstanceGroupManagerScheduledActionGroup from the specified map of raw messages.
func UnmarshalInstanceGroupManagerScheduledActionGroup(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceGroupManagerScheduledActionGroup)
err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount)
if err != nil {
err = core.SDKErrorf(err, "", "membership_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceGroupManagerScheduledActionGroupPrototype : InstanceGroupManagerScheduledActionGroupPrototype struct
type InstanceGroupManagerScheduledActionGroupPrototype struct {
// The desired number of instance group members at the scheduled time.
MembershipCount *int64 `json:"membership_count" validate:"required"`
}
// NewInstanceGroupManagerScheduledActionGroupPrototype : Instantiate InstanceGroupManagerScheduledActionGroupPrototype (Generic Model Constructor)
func (*VpcV1) NewInstanceGroupManagerScheduledActionGroupPrototype(membershipCount int64) (_model *InstanceGroupManagerScheduledActionGroupPrototype, err error) {
_model = &InstanceGroupManagerScheduledActionGroupPrototype{
MembershipCount: core.Int64Ptr(membershipCount),
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalInstanceGroupManagerScheduledActionGroupPrototype unmarshals an instance of InstanceGroupManagerScheduledActionGroupPrototype from the specified map of raw messages.
func UnmarshalInstanceGroupManagerScheduledActionGroupPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceGroupManagerScheduledActionGroupPrototype)
err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount)
if err != nil {
err = core.SDKErrorf(err, "", "membership_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceGroupManagerScheduledActionManager : InstanceGroupManagerScheduledActionManager struct
// Models which "extend" this model:
// - InstanceGroupManagerScheduledActionManagerAutoScale
type InstanceGroupManagerScheduledActionManager struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this instance group manager.
Href *string `json:"href,omitempty"`
// The unique identifier for this instance group manager.
ID *string `json:"id,omitempty"`
// The name for this instance group manager. The name is unique across all managers for the instance group.
Name *string `json:"name,omitempty"`
// The desired maximum number of instance group members at the scheduled time.
MaxMembershipCount *int64 `json:"max_membership_count,omitempty"`
// The desired minimum number of instance group members at the scheduled time.
MinMembershipCount *int64 `json:"min_membership_count,omitempty"`
}
func (*InstanceGroupManagerScheduledActionManager) isaInstanceGroupManagerScheduledActionManager() bool {
return true
}
type InstanceGroupManagerScheduledActionManagerIntf interface {
isaInstanceGroupManagerScheduledActionManager() bool
}
// UnmarshalInstanceGroupManagerScheduledActionManager unmarshals an instance of InstanceGroupManagerScheduledActionManager from the specified map of raw messages.
func UnmarshalInstanceGroupManagerScheduledActionManager(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceGroupManagerScheduledActionManager)
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount)
if err != nil {
err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount)
if err != nil {
err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceGroupManagerScheduledActionManagerPrototype : InstanceGroupManagerScheduledActionManagerPrototype struct
// Models which "extend" this model:
// - InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype
type InstanceGroupManagerScheduledActionManagerPrototype struct {
// The desired maximum number of instance group members at the scheduled time.
MaxMembershipCount *int64 `json:"max_membership_count,omitempty"`
// The desired minimum number of instance group members at the scheduled time.
MinMembershipCount *int64 `json:"min_membership_count,omitempty"`
// The unique identifier for this instance group manager.
ID *string `json:"id,omitempty"`
// The URL for this instance group manager.
Href *string `json:"href,omitempty"`
}
func (*InstanceGroupManagerScheduledActionManagerPrototype) isaInstanceGroupManagerScheduledActionManagerPrototype() bool {
return true
}
type InstanceGroupManagerScheduledActionManagerPrototypeIntf interface {
isaInstanceGroupManagerScheduledActionManagerPrototype() bool
}
// UnmarshalInstanceGroupManagerScheduledActionManagerPrototype unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototype from the specified map of raw messages.
func UnmarshalInstanceGroupManagerScheduledActionManagerPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceGroupManagerScheduledActionManagerPrototype)
err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount)
if err != nil {
err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount)
if err != nil {
err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceGroupMembership : InstanceGroupMembership struct
type InstanceGroupMembership struct {
// The date and time that the instance group manager policy was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// 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 name for this instance group membership. The name is unique across all memberships for 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
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
// The date and time that the instance group membership was updated.
UpdatedAt *strfmt.DateTime `json:"updated_at" 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
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "delete_instance_on_membership_delete", &obj.DeleteInstanceOnMembershipDelete)
if err != nil {
err = core.SDKErrorf(err, "", "delete_instance_on_membership_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalInstanceReference)
if err != nil {
err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference)
if err != nil {
err = core.SDKErrorf(err, "", "instance_template-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "pool_member", &obj.PoolMember, UnmarshalLoadBalancerPoolMemberReference)
if err != nil {
err = core.SDKErrorf(err, "", "pool_member-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo())
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 *PageLink `json:"first" validate:"required"`
// The maximum number of resources that can be returned by the request.
Limit *int64 `json:"limit" validate:"required"`
// A page of memberships for the instance group.
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 *PageLink `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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "memberships", &obj.Memberships, UnmarshalInstanceGroupMembership)
if err != nil {
err = core.SDKErrorf(err, "", "memberships-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *InstanceGroupMembershipCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// InstanceGroupMembershipPatch : InstanceGroupMembershipPatch struct
type InstanceGroupMembershipPatch struct {
// If set to true, when deleting the membership the instance will also be deleted.
DeleteInstanceOnMembershipDelete *bool `json:"delete_instance_on_membership_delete,omitempty"`
// The name for this instance group membership. The name must not be used by another membership for the instance group
// manager.
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, "delete_instance_on_membership_delete", &obj.DeleteInstanceOnMembershipDelete)
if err != nil {
err = core.SDKErrorf(err, "", "delete_instance_on_membership_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(instanceGroupMembershipPatch.DeleteInstanceOnMembershipDelete) {
_patch["delete_instance_on_membership_delete"] = instanceGroupMembershipPatch.DeleteInstanceOnMembershipDelete
}
if !core.IsNil(instanceGroupMembershipPatch.Name) {
_patch["name"] = instanceGroupMembershipPatch.Name
}
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 {
// The port to use for new load balancer pool members created by this instance group.
//
// This property must be set if and only if `load_balancer_pool` has been set.
ApplicationPort *int64 `json:"application_port,omitempty"`
// The instance template to use when creating new instances.
//
// The specified template must not have `default_trusted_profile.auto_link` set to `true`.
InstanceTemplate InstanceTemplateIdentityIntf `json:"instance_template,omitempty"`
// The load balancer associated with `load_balancer_pool`.
// The load balancer must have `instance_groups_supported` set to `true`.
//
// This property must be set if and only if `load_balancer_pool` has been set.
LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"`
// If specified, this instance group will manage the load balancer pool. A pool member
// will be created for each instance created by this group. The specified load
// balancer pool must not be used by another instance group in the VPC.
//
// If set, `load_balancer` and `application_port` must also be set.
LoadBalancerPool LoadBalancerPoolIdentityIntf `json:"load_balancer_pool,omitempty"`
// The number of instances in the instance group.
MembershipCount *int64 `json:"membership_count,omitempty"`
// The name for this instance group. The name must not be used by another instance group in the region.
Name *string `json:"name,omitempty"`
// The 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 {
err = core.SDKErrorf(err, "", "application_port-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "instance_template-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "load_balancer", &obj.LoadBalancer, UnmarshalLoadBalancerIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "load_balancer-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "load_balancer_pool-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount)
if err != nil {
err = core.SDKErrorf(err, "", "membership_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(instanceGroupPatch.ApplicationPort) {
_patch["application_port"] = instanceGroupPatch.ApplicationPort
}
if !core.IsNil(instanceGroupPatch.InstanceTemplate) {
_patch["instance_template"] = instanceGroupPatch.InstanceTemplate.asPatch()
}
if !core.IsNil(instanceGroupPatch.LoadBalancer) {
_patch["load_balancer"] = instanceGroupPatch.LoadBalancer.asPatch()
}
if !core.IsNil(instanceGroupPatch.LoadBalancerPool) {
_patch["load_balancer_pool"] = instanceGroupPatch.LoadBalancerPool.asPatch()
}
if !core.IsNil(instanceGroupPatch.MembershipCount) {
_patch["membership_count"] = instanceGroupPatch.MembershipCount
}
if !core.IsNil(instanceGroupPatch.Name) {
_patch["name"] = instanceGroupPatch.Name
}
if !core.IsNil(instanceGroupPatch.Subnets) {
var subnetsPatches []map[string]interface{}
for _, subnets := range instanceGroupPatch.Subnets {
subnetsPatches = append(subnetsPatches, subnets.asPatch())
}
_patch["subnets"] = subnetsPatches
}
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 *Deleted `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 name for this instance group. The name is unique across all instance groups in the region.
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 {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceHealthReason : InstanceHealthReason struct
type InstanceHealthReason struct {
// A reason code for this health state:
// - `reservation_capacity_unavailable`: The reservation affinity pool has no
// available capacity.
// - `reservation_deleted`: The reservation affinity pool has a deleted reservation.
// - `reservation_expired`: The reservation affinity pool has an expired reservation.
// - `reservation_failed`: The reservation affinity pool has a failed reservation.
//
// See [health status reasons](https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons) for details. The
// enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this health state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this health state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the InstanceHealthReason.Code property.
// A reason code for this health state:
// - `reservation_capacity_unavailable`: The reservation affinity pool has no
// available capacity.
// - `reservation_deleted`: The reservation affinity pool has a deleted reservation.
// - `reservation_expired`: The reservation affinity pool has an expired reservation.
// - `reservation_failed`: The reservation affinity pool has a failed reservation.
//
// See [health status reasons](https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons) for details. The
// enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
InstanceHealthReasonCodeReservationCapacityUnavailableConst = "reservation_capacity_unavailable"
InstanceHealthReasonCodeReservationDeletedConst = "reservation_deleted"
InstanceHealthReasonCodeReservationExpiredConst = "reservation_expired"
InstanceHealthReasonCodeReservationFailedConst = "reservation_failed"
)
// UnmarshalInstanceHealthReason unmarshals an instance of InstanceHealthReason from the specified map of raw messages.
func UnmarshalInstanceHealthReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceHealthReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceInitialization : InstanceInitialization struct
type InstanceInitialization struct {
// The default trusted profile configuration specified at virtual server instance
// creation. If absent, no default trusted profile was specified.
DefaultTrustedProfile *InstanceInitializationDefaultTrustedProfile `json:"default_trusted_profile,omitempty"`
// The public SSH keys used at instance initialization.
Keys []KeyReference `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, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceInitializationDefaultTrustedProfile)
if err != nil {
err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference)
if err != nil {
err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "password", &obj.Password, UnmarshalInstanceInitializationPassword)
if err != nil {
err = core.SDKErrorf(err, "", "password-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceInitializationDefaultTrustedProfile : InstanceInitializationDefaultTrustedProfile struct
type InstanceInitializationDefaultTrustedProfile struct {
// If set to `true`, the system created a link to the specified `target` trusted profile during instance creation.
// Regardless of whether a link was created by the system or manually using the IAM Identity service, it will be
// automatically deleted when the instance is deleted.
AutoLink *bool `json:"auto_link" validate:"required"`
// The default IAM trusted profile to use for this virtual server instance.
Target *TrustedProfileReference `json:"target" validate:"required"`
}
// UnmarshalInstanceInitializationDefaultTrustedProfile unmarshals an instance of InstanceInitializationDefaultTrustedProfile from the specified map of raw messages.
func UnmarshalInstanceInitializationDefaultTrustedProfile(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceInitializationDefaultTrustedProfile)
err = core.UnmarshalPrimitive(m, "auto_link", &obj.AutoLink)
if err != nil {
err = core.SDKErrorf(err, "", "auto_link-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalTrustedProfileReference)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
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 public SSH key used to encrypt the administrator password.
EncryptionKey *KeyIdentityByFingerprint `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 {
err = core.SDKErrorf(err, "", "encrypted_password-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyIdentityByFingerprint)
if err != nil {
err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceLifecycleReason : InstanceLifecycleReason struct
type InstanceLifecycleReason struct {
// A reason code for this lifecycle state:
// - `failed_registration`: the instance's registration to Resource Controller has
// failed. Delete the instance and provision it again. If the problem persists,
// contact IBM Support.
// - `internal_error`: internal error (contact IBM support)
// - `pending_registration`: the instance's registration to Resource Controller is
// being processed.
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this lifecycle state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this lifecycle state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the InstanceLifecycleReason.Code property.
// A reason code for this lifecycle state:
// - `failed_registration`: the instance's registration to Resource Controller has
// failed. Delete the instance and provision it again. If the problem persists,
// contact IBM Support.
// - `internal_error`: internal error (contact IBM support)
// - `pending_registration`: the instance's registration to Resource Controller is
// being processed.
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
InstanceLifecycleReasonCodeFailedRegistrationConst = "failed_registration"
InstanceLifecycleReasonCodeInternalErrorConst = "internal_error"
InstanceLifecycleReasonCodePendingRegistrationConst = "pending_registration"
InstanceLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider"
)
// UnmarshalInstanceLifecycleReason unmarshals an instance of InstanceLifecycleReason from the specified map of raw messages.
func UnmarshalInstanceLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceLifecycleReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceMetadataService : The metadata service configuration.
type InstanceMetadataService struct {
// Indicates whether the metadata service endpoint is available to the virtual server instance.
Enabled *bool `json:"enabled" validate:"required"`
// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is
// enabled.
// - `http`: HTTP protocol (unencrypted)
// - `https`: HTTP Secure protocol.
Protocol *string `json:"protocol" validate:"required"`
// The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata
// service is enabled.
ResponseHopLimit *int64 `json:"response_hop_limit" validate:"required"`
}
// Constants associated with the InstanceMetadataService.Protocol property.
// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is
// enabled.
// - `http`: HTTP protocol (unencrypted)
// - `https`: HTTP Secure protocol.
const (
InstanceMetadataServiceProtocolHTTPConst = "http"
InstanceMetadataServiceProtocolHTTPSConst = "https"
)
// UnmarshalInstanceMetadataService unmarshals an instance of InstanceMetadataService from the specified map of raw messages.
func UnmarshalInstanceMetadataService(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceMetadataService)
err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled)
if err != nil {
err = core.SDKErrorf(err, "", "enabled-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol)
if err != nil {
err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit)
if err != nil {
err = core.SDKErrorf(err, "", "response_hop_limit-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceMetadataServicePatch : The metadata service configuration.
type InstanceMetadataServicePatch struct {
// Indicates whether the metadata service endpoint will be available to the virtual server instance.
Enabled *bool `json:"enabled,omitempty"`
// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is
// enabled.
// - `http`: HTTP protocol (unencrypted)
// - `https`: HTTP Secure protocol.
Protocol *string `json:"protocol,omitempty"`
// The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata
// service is enabled.
ResponseHopLimit *int64 `json:"response_hop_limit,omitempty"`
}
// Constants associated with the InstanceMetadataServicePatch.Protocol property.
// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is
// enabled.
// - `http`: HTTP protocol (unencrypted)
// - `https`: HTTP Secure protocol.
const (
InstanceMetadataServicePatchProtocolHTTPConst = "http"
InstanceMetadataServicePatchProtocolHTTPSConst = "https"
)
// UnmarshalInstanceMetadataServicePatch unmarshals an instance of InstanceMetadataServicePatch from the specified map of raw messages.
func UnmarshalInstanceMetadataServicePatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceMetadataServicePatch)
err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled)
if err != nil {
err = core.SDKErrorf(err, "", "enabled-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol)
if err != nil {
err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit)
if err != nil {
err = core.SDKErrorf(err, "", "response_hop_limit-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the InstanceMetadataServicePatch
func (instanceMetadataServicePatch *InstanceMetadataServicePatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(instanceMetadataServicePatch.Enabled) {
_patch["enabled"] = instanceMetadataServicePatch.Enabled
}
if !core.IsNil(instanceMetadataServicePatch.Protocol) {
_patch["protocol"] = instanceMetadataServicePatch.Protocol
}
if !core.IsNil(instanceMetadataServicePatch.ResponseHopLimit) {
_patch["response_hop_limit"] = instanceMetadataServicePatch.ResponseHopLimit
}
return
}
// InstanceMetadataServicePrototype : The metadata service configuration.
type InstanceMetadataServicePrototype struct {
// Indicates whether the metadata service endpoint will be available to the virtual server instance.
Enabled *bool `json:"enabled,omitempty"`
// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is
// enabled.
// - `http`: HTTP protocol (unencrypted)
// - `https`: HTTP Secure protocol.
Protocol *string `json:"protocol,omitempty"`
// The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata
// service is enabled.
ResponseHopLimit *int64 `json:"response_hop_limit,omitempty"`
}
// Constants associated with the InstanceMetadataServicePrototype.Protocol property.
// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is
// enabled.
// - `http`: HTTP protocol (unencrypted)
// - `https`: HTTP Secure protocol.
const (
InstanceMetadataServicePrototypeProtocolHTTPConst = "http"
InstanceMetadataServicePrototypeProtocolHTTPSConst = "https"
)
// UnmarshalInstanceMetadataServicePrototype unmarshals an instance of InstanceMetadataServicePrototype from the specified map of raw messages.
func UnmarshalInstanceMetadataServicePrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceMetadataServicePrototype)
err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled)
if err != nil {
err = core.SDKErrorf(err, "", "enabled-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol)
if err != nil {
err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit)
if err != nil {
err = core.SDKErrorf(err, "", "response_hop_limit-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceNetworkAttachment : InstanceNetworkAttachment struct
type InstanceNetworkAttachment struct {
// The date and time that the instance network attachment was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The URL for this instance network attachment.
Href *string `json:"href" validate:"required"`
// The unique identifier for this instance network attachment.
ID *string `json:"id" validate:"required"`
// The lifecycle state of the instance network attachment.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The name for this instance network attachment. The name is unique across all network attachments for the instance.
Name *string `json:"name" validate:"required"`
// The port speed for this instance network attachment in Mbps.
PortSpeed *int64 `json:"port_speed" validate:"required"`
// The primary IP address of the virtual network interface for the instance network
// attachment.
PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The subnet of the virtual network interface for the instance network attachment.
Subnet *SubnetReference `json:"subnet" validate:"required"`
// The instance network attachment type.
Type *string `json:"type" validate:"required"`
// The virtual network interface for this instance network attachment.
VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"`
}
// Constants associated with the InstanceNetworkAttachment.LifecycleState property.
// The lifecycle state of the instance network attachment.
const (
InstanceNetworkAttachmentLifecycleStateDeletingConst = "deleting"
InstanceNetworkAttachmentLifecycleStateFailedConst = "failed"
InstanceNetworkAttachmentLifecycleStatePendingConst = "pending"
InstanceNetworkAttachmentLifecycleStateStableConst = "stable"
InstanceNetworkAttachmentLifecycleStateSuspendedConst = "suspended"
InstanceNetworkAttachmentLifecycleStateUpdatingConst = "updating"
InstanceNetworkAttachmentLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the InstanceNetworkAttachment.ResourceType property.
// The resource type.
const (
InstanceNetworkAttachmentResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment"
)
// Constants associated with the InstanceNetworkAttachment.Type property.
// The instance network attachment type.
const (
InstanceNetworkAttachmentTypePrimaryConst = "primary"
InstanceNetworkAttachmentTypeSecondaryConst = "secondary"
)
// UnmarshalInstanceNetworkAttachment unmarshals an instance of InstanceNetworkAttachment from the specified map of raw messages.
func UnmarshalInstanceNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceNetworkAttachment)
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed)
if err != nil {
err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext)
if err != nil {
err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceNetworkAttachmentCollection : InstanceNetworkAttachmentCollection struct
type InstanceNetworkAttachmentCollection struct {
// The network attachments for the instance.
NetworkAttachments []InstanceNetworkAttachment `json:"network_attachments" validate:"required"`
}
// UnmarshalInstanceNetworkAttachmentCollection unmarshals an instance of InstanceNetworkAttachmentCollection from the specified map of raw messages.
func UnmarshalInstanceNetworkAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceNetworkAttachmentCollection)
err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachment)
if err != nil {
err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceNetworkAttachmentPatch : InstanceNetworkAttachmentPatch struct
type InstanceNetworkAttachmentPatch struct {
// The name for this network attachment. The name must not be used by another network attachment for the instance.
Name *string `json:"name,omitempty"`
}
// UnmarshalInstanceNetworkAttachmentPatch unmarshals an instance of InstanceNetworkAttachmentPatch from the specified map of raw messages.
func UnmarshalInstanceNetworkAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceNetworkAttachmentPatch)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the InstanceNetworkAttachmentPatch
func (instanceNetworkAttachmentPatch *InstanceNetworkAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(instanceNetworkAttachmentPatch.Name) {
_patch["name"] = instanceNetworkAttachmentPatch.Name
}
return
}
// InstanceNetworkAttachmentPrototype : InstanceNetworkAttachmentPrototype struct
type InstanceNetworkAttachmentPrototype struct {
// The name for this network attachment. Names must be unique within the instance the network attachment resides in. If
// unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// A virtual network interface for the instance network attachment. This can be specified
// using an existing virtual network interface, or a prototype object for a new virtual
// network interface.
//
// If an existing virtual network interface is specified, `enable_infrastructure_nat` must be
// `true`.
VirtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"`
}
// NewInstanceNetworkAttachmentPrototype : Instantiate InstanceNetworkAttachmentPrototype (Generic Model Constructor)
func (*VpcV1) NewInstanceNetworkAttachmentPrototype(virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) (_model *InstanceNetworkAttachmentPrototype, err error) {
_model = &InstanceNetworkAttachmentPrototype{
VirtualNetworkInterface: virtualNetworkInterface,
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalInstanceNetworkAttachmentPrototype unmarshals an instance of InstanceNetworkAttachmentPrototype from the specified map of raw messages.
func UnmarshalInstanceNetworkAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceNetworkAttachmentPrototype)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface)
if err != nil {
err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceNetworkAttachmentPrototypeVirtualNetworkInterface : A virtual network interface for the instance network attachment. This can be specified using an existing virtual
// network interface, or a prototype object for a new virtual network interface.
//
// If an existing virtual network interface is specified, `enable_infrastructure_nat` must be
// `true`.
// Models which "extend" this model:
// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext
// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity
type InstanceNetworkAttachmentPrototypeVirtualNetworkInterface 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"`
// Indicates whether this virtual network interface will be automatically deleted when
// `target` is deleted.
AutoDelete *bool `json:"auto_delete,omitempty"`
// If `true`:
// - The VPC infrastructure performs any needed NAT operations.
// - `floating_ips` must not have more than one floating IP.
//
// If `false`:
// - Packets are passed unchanged to/from the virtual network interface,
// allowing the workload to perform any needed NAT operations.
// - `allow_ip_spoofing` must be `false`.
// - Can only be attached to a `target` with a `resource_type` of
// `bare_metal_server_network_attachment`.
EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"`
// The additional IP addresses to bind to the virtual network interface. Each item may be either a reserved IP
// identity, or a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be
// in the primary IP's subnet.
//
// If reserved IP identities are provided, the specified reserved IPs must be unbound.
//
// If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network
// interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet
// will be automatically selected and reserved.
Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"`
// The name for this virtual network interface. The name must not be used by another virtual network interface in the
// VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are
// reserved for provider-owned resources, and are not allowed.
Name *string `json:"name,omitempty"`
// The primary IP address to bind to the virtual network interface. May be either a
// reserved IP identity, or a reserved IP prototype object which will be used to create a
// new reserved IP.
//
// If a reserved IP identity is provided, the specified reserved IP must be unbound.
//
// If a reserved IP prototype object with an address is provided, the address must be
// available on the virtual network interface's subnet. If no address is specified,
// an available address on the subnet will be automatically selected and reserved.
PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"`
// The protocol state filtering mode to use for this virtual network interface. If
// `auto`, protocol state packet filtering is enabled or disabled based on the virtual network interface's `target`
// resource type:
//
// - `bare_metal_server_network_attachment`: disabled
// - `instance_network_attachment`: enabled
// - `share_mount_target`: enabled
//
// Protocol state filtering monitors each network connection flowing over this virtual network interface, and drops any
// packets that are invalid based on the current connection state and protocol. See [Protocol state filtering
// mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information.
ProtocolStateFilteringMode *string `json:"protocol_state_filtering_mode,omitempty"`
// The resource group to use for this virtual network interface. If unspecified, the
// virtual server instance's resource group will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC
// for the subnet is used.
SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"`
// The associated subnet. Required if `primary_ip` does not specify a reserved IP
// identity.
Subnet SubnetIdentityIntf `json:"subnet,omitempty"`
// The unique identifier for this virtual network interface.
ID *string `json:"id,omitempty"`
// The URL for this virtual network interface.
Href *string `json:"href,omitempty"`
// The CRN for this virtual network interface.
CRN *string `json:"crn,omitempty"`
}
// Constants associated with the InstanceNetworkAttachmentPrototypeVirtualNetworkInterface.ProtocolStateFilteringMode property.
// The protocol state filtering mode to use for this virtual network interface. If
// `auto`, protocol state packet filtering is enabled or disabled based on the virtual network interface's `target`
// resource type:
//
// - `bare_metal_server_network_attachment`: disabled
// - `instance_network_attachment`: enabled
// - `share_mount_target`: enabled
//
// Protocol state filtering monitors each network connection flowing over this virtual network interface, and drops any
// packets that are invalid based on the current connection state and protocol. See [Protocol state filtering
// mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information.
const (
InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeAutoConst = "auto"
InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeDisabledConst = "disabled"
InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeEnabledConst = "enabled"
)
func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterface) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool {
return true
}
type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf interface {
isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool
}
// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterface from the specified map of raw messages.
func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterface)
err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing)
if err != nil {
err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat)
if err != nil {
err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "ips-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "protocol_state_filtering_mode", &obj.ProtocolStateFilteringMode)
if err != nil {
err = core.SDKErrorf(err, "", "protocol_state_filtering_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceNetworkAttachmentReference : InstanceNetworkAttachmentReference struct
type InstanceNetworkAttachmentReference struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this instance network attachment.
Href *string `json:"href" validate:"required"`
// The unique identifier for this instance network attachment.
ID *string `json:"id" validate:"required"`
// The name for this instance network attachment. The name is unique across all network attachments for the instance.
Name *string `json:"name" validate:"required"`
// The primary IP address of the virtual network interface for the instance network
// attachment.
PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The subnet of the virtual network interface for the instance network attachment.
Subnet *SubnetReference `json:"subnet" validate:"required"`
// The virtual network interface for this instance network attachment.
VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"`
}
// Constants associated with the InstanceNetworkAttachmentReference.ResourceType property.
// The resource type.
const (
InstanceNetworkAttachmentReferenceResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment"
)
// UnmarshalInstanceNetworkAttachmentReference unmarshals an instance of InstanceNetworkAttachmentReference from the specified map of raw messages.
func UnmarshalInstanceNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceNetworkAttachmentReference)
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext)
if err != nil {
err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstancePatch : InstancePatch struct
type InstancePatch struct {
// The availability policy for this virtual server instance.
AvailabilityPolicy *InstanceAvailabilityPolicyPatch `json:"availability_policy,omitempty"`
// The confidential compute mode to use for this virtual server instance.
//
// For this property to be changed, the virtual server instance `status` must be
// `stopping` or `stopped`.
ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"`
// Indicates whether secure boot is enabled for this virtual server instance.
//
// For this property to be changed, the virtual server instance `status` must be
// `stopping` or `stopped`.
EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"`
// The metadata service configuration.
MetadataService *InstanceMetadataServicePatch `json:"metadata_service,omitempty"`
// The name for this virtual server instance. The name must not be used by another virtual server instance in the
// region. Changing the name will not affect the system hostname.
Name *string `json:"name,omitempty"`
// The placement restrictions to use for the virtual server instance. For the
// placement restrictions to be changed, the instance `status` must be `stopping` or
// `stopped`.
//
// If set, `reservation_affinity.policy` must be `disabled`.
PlacementTarget InstancePlacementTargetPatchIntf `json:"placement_target,omitempty"`
// The profile to use for this virtual server instance. Any disks associated with the
// current profile will be deleted, and any disks associated with the requested profile
// will be created.
//
// For the profile to be changed, the instance `status` must be `stopping` or `stopped`.
// In addition, the requested profile must:
// - 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`.
// - Have the same `vcpu.architecture`.
// - Support the number of network attachments or network interfaces the instance
// currently has.
Profile InstancePatchProfileIntf `json:"profile,omitempty"`
ReservationAffinity *InstanceReservationAffinityPatch `json:"reservation_affinity,omitempty"`
// The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in
// this value will result in a corresponding decrease to
// `total_network_bandwidth`.
TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"`
}
// Constants associated with the InstancePatch.ConfidentialComputeMode property.
// The confidential compute mode to use for this virtual server instance.
//
// For this property to be changed, the virtual server instance `status` must be
// `stopping` or `stopped`.
const (
InstancePatchConfidentialComputeModeDisabledConst = "disabled"
InstancePatchConfidentialComputeModeSgxConst = "sgx"
InstancePatchConfidentialComputeModeTdxConst = "tdx"
)
// 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.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPatch)
if err != nil {
err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode)
if err != nil {
err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot)
if err != nil {
err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePatch)
if err != nil {
err = core.SDKErrorf(err, "", "metadata_service-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPatch)
if err != nil {
err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstancePatchProfile)
if err != nil {
err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPatch)
if err != nil {
err = core.SDKErrorf(err, "", "reservation_affinity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth)
if err != nil {
err = core.SDKErrorf(err, "", "total_volume_bandwidth-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(instancePatch.AvailabilityPolicy) {
_patch["availability_policy"] = instancePatch.AvailabilityPolicy.asPatch()
}
if !core.IsNil(instancePatch.ConfidentialComputeMode) {
_patch["confidential_compute_mode"] = instancePatch.ConfidentialComputeMode
}
if !core.IsNil(instancePatch.EnableSecureBoot) {
_patch["enable_secure_boot"] = instancePatch.EnableSecureBoot
}
if !core.IsNil(instancePatch.MetadataService) {
_patch["metadata_service"] = instancePatch.MetadataService.asPatch()
}
if !core.IsNil(instancePatch.Name) {
_patch["name"] = instancePatch.Name
}
if !core.IsNil(instancePatch.PlacementTarget) {
_patch["placement_target"] = instancePatch.PlacementTarget.asPatch()
}
if !core.IsNil(instancePatch.Profile) {
_patch["profile"] = instancePatch.Profile.asPatch()
}
if !core.IsNil(instancePatch.ReservationAffinity) {
_patch["reservation_affinity"] = instancePatch.ReservationAffinity.asPatch()
}
if !core.IsNil(instancePatch.TotalVolumeBandwidth) {
_patch["total_volume_bandwidth"] = instancePatch.TotalVolumeBandwidth
}
return
}
// InstancePatchProfile : The profile to use for this virtual server instance. Any disks associated with the current profile will be deleted,
// and any disks associated with the requested profile will be created.
//
// For the profile to be changed, the instance `status` must be `stopping` or `stopped`. In addition, the requested
// profile must:
// - 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`.
// - Have the same `vcpu.architecture`.
// - Support the number of network attachments or network interfaces the instance
// currently has.
//
// 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
asPatch() map[string]interface{}
}
// 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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the InstancePatchProfile
func (instancePatchProfile *InstancePatchProfile) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(instancePatchProfile.Name) {
_patch["name"] = instancePatchProfile.Name
}
if !core.IsNil(instancePatchProfile.Href) {
_patch["href"] = instancePatchProfile.Href
}
return
}
// InstancePlacementTarget : The placement restrictions for the virtual server instance.
// Models which "extend" this model:
// - InstancePlacementTargetDedicatedHostGroupReference
// - InstancePlacementTargetDedicatedHostReference
// - InstancePlacementTargetPlacementGroupReference
type InstancePlacementTarget struct {
// The CRN for this dedicated host group.
CRN *string `json:"crn,omitempty"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this dedicated host group.
Href *string `json:"href,omitempty"`
// The unique identifier for this dedicated host group.
ID *string `json:"id,omitempty"`
// The name for this dedicated host group. The name is unique across all dedicated host groups in the region.
Name *string `json:"name,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type,omitempty"`
}
// Constants associated with the InstancePlacementTarget.ResourceType property.
// The resource type.
const (
InstancePlacementTargetResourceTypeDedicatedHostGroupConst = "dedicated_host_group"
)
func (*InstancePlacementTarget) isaInstancePlacementTarget() bool {
return true
}
type InstancePlacementTargetIntf interface {
isaInstancePlacementTarget() bool
}
// UnmarshalInstancePlacementTarget unmarshals an instance of InstancePlacementTarget from the specified map of raw messages.
func UnmarshalInstancePlacementTarget(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstancePlacementTarget)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstancePlacementTargetPatch : The placement restrictions to use for the virtual server instance. For the placement restrictions to be changed, the
// instance `status` must be `stopping` or
// `stopped`.
//
// If set, `reservation_affinity.policy` must be `disabled`.
// Models which "extend" this model:
// - InstancePlacementTargetPatchDedicatedHostIdentity
// - InstancePlacementTargetPatchDedicatedHostGroupIdentity
type InstancePlacementTargetPatch struct {
// The unique identifier for this dedicated host.
ID *string `json:"id,omitempty"`
// The CRN for this dedicated host.
CRN *string `json:"crn,omitempty"`
// The URL for this dedicated host.
Href *string `json:"href,omitempty"`
}
func (*InstancePlacementTargetPatch) isaInstancePlacementTargetPatch() bool {
return true
}
type InstancePlacementTargetPatchIntf interface {
isaInstancePlacementTargetPatch() bool
asPatch() map[string]interface{}
}
// UnmarshalInstancePlacementTargetPatch unmarshals an instance of InstancePlacementTargetPatch from the specified map of raw messages.
func UnmarshalInstancePlacementTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstancePlacementTargetPatch)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the InstancePlacementTargetPatch
func (instancePlacementTargetPatch *InstancePlacementTargetPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(instancePlacementTargetPatch.ID) {
_patch["id"] = instancePlacementTargetPatch.ID
}
if !core.IsNil(instancePlacementTargetPatch.CRN) {
_patch["crn"] = instancePlacementTargetPatch.CRN
}
if !core.IsNil(instancePlacementTargetPatch.Href) {
_patch["href"] = instancePlacementTargetPatch.Href
}
return
}
// InstancePlacementTargetPrototype : The placement restrictions to use for the virtual server instance.
//
// If specified, `reservation_affinity.policy` must be `disabled`.
// Models which "extend" this model:
// - InstancePlacementTargetPrototypeDedicatedHostIdentity
// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentity
// - InstancePlacementTargetPrototypePlacementGroupIdentity
type InstancePlacementTargetPrototype struct {
// The unique identifier for this dedicated host.
ID *string `json:"id,omitempty"`
// The CRN for this dedicated host.
CRN *string `json:"crn,omitempty"`
// The URL for this dedicated host.
Href *string `json:"href,omitempty"`
}
func (*InstancePlacementTargetPrototype) isaInstancePlacementTargetPrototype() bool {
return true
}
type InstancePlacementTargetPrototypeIntf interface {
isaInstancePlacementTargetPrototype() bool
}
// UnmarshalInstancePlacementTargetPrototype unmarshals an instance of InstancePlacementTargetPrototype from the specified map of raw messages.
func UnmarshalInstancePlacementTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstancePlacementTargetPrototype)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceProfile : InstanceProfile struct
type InstanceProfile struct {
Bandwidth InstanceProfileBandwidthIntf `json:"bandwidth" validate:"required"`
ClusterNetworkAttachmentCount InstanceProfileClusterNetworkAttachmentCountIntf `json:"cluster_network_attachment_count" validate:"required"`
ConfidentialComputeModes *InstanceProfileSupportedConfidentialComputeModes `json:"confidential_compute_modes" validate:"required"`
// The disks for an instance with this profile.
Disks []InstanceProfileDisk `json:"disks" validate:"required"`
// The product family this virtual server instance profile belongs to.
Family *string `json:"family" validate:"required"`
GpuCount InstanceProfileGpuIntf `json:"gpu_count,omitempty"`
GpuManufacturer *InstanceProfileGpuManufacturer `json:"gpu_manufacturer,omitempty"`
GpuMemory InstanceProfileGpuMemoryIntf `json:"gpu_memory,omitempty"`
GpuModel *InstanceProfileGpuModel `json:"gpu_model,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"`
NetworkAttachmentCount InstanceProfileNetworkAttachmentCountIntf `json:"network_attachment_count" validate:"required"`
NetworkInterfaceCount InstanceProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"`
NumaCount InstanceProfileNumaCountIntf `json:"numa_count,omitempty"`
OsArchitecture *InstanceProfileOsArchitecture `json:"os_architecture" validate:"required"`
PortSpeed InstanceProfilePortSpeedIntf `json:"port_speed" validate:"required"`
ReservationTerms *InstanceProfileReservationTerms `json:"reservation_terms" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
SecureBootModes *InstanceProfileSupportedSecureBootModes `json:"secure_boot_modes" validate:"required"`
// The status of the instance profile:
// - `previous`: This instance profile is an older revision, but remains provisionable and
// usable.
// - `current`: This profile is the latest revision.
//
// Revisions are indicated by the generation of an instance profile. Refer to the [profile naming
// conventions](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on
// how generations are defined within an instance profile.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
// The cluster network profiles that support this instance profile.
SupportedClusterNetworkProfiles []ClusterNetworkProfileReference `json:"supported_cluster_network_profiles" validate:"required"`
TotalVolumeBandwidth InstanceProfileVolumeBandwidthIntf `json:"total_volume_bandwidth" validate:"required"`
VcpuArchitecture *InstanceProfileVcpuArchitecture `json:"vcpu_architecture" validate:"required"`
VcpuCount InstanceProfileVcpuIntf `json:"vcpu_count" validate:"required"`
VcpuManufacturer InstanceProfileVcpuManufacturerIntf `json:"vcpu_manufacturer" validate:"required"`
}
// Constants associated with the InstanceProfile.ResourceType property.
// The resource type.
const (
InstanceProfileResourceTypeInstanceProfileConst = "instance_profile"
)
// Constants associated with the InstanceProfile.Status property.
// The status of the instance profile:
// - `previous`: This instance profile is an older revision, but remains provisionable and
// usable.
// - `current`: This profile is the latest revision.
//
// Revisions are indicated by the generation of an instance profile. Refer to the [profile naming
// conventions](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on
// how generations are defined within an instance profile.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
InstanceProfileStatusCurrentConst = "current"
InstanceProfileStatusPreviousConst = "previous"
)
// 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 {
err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "cluster_network_attachment_count", &obj.ClusterNetworkAttachmentCount, UnmarshalInstanceProfileClusterNetworkAttachmentCount)
if err != nil {
err = core.SDKErrorf(err, "", "cluster_network_attachment_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "confidential_compute_modes", &obj.ConfidentialComputeModes, UnmarshalInstanceProfileSupportedConfidentialComputeModes)
if err != nil {
err = core.SDKErrorf(err, "", "confidential_compute_modes-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceProfileDisk)
if err != nil {
err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "family", &obj.Family)
if err != nil {
err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "gpu_count", &obj.GpuCount, UnmarshalInstanceProfileGpu)
if err != nil {
err = core.SDKErrorf(err, "", "gpu_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "gpu_manufacturer", &obj.GpuManufacturer, UnmarshalInstanceProfileGpuManufacturer)
if err != nil {
err = core.SDKErrorf(err, "", "gpu_manufacturer-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "gpu_memory", &obj.GpuMemory, UnmarshalInstanceProfileGpuMemory)
if err != nil {
err = core.SDKErrorf(err, "", "gpu_memory-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "gpu_model", &obj.GpuModel, UnmarshalInstanceProfileGpuModel)
if err != nil {
err = core.SDKErrorf(err, "", "gpu_model-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalInstanceProfileMemory)
if err != nil {
err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_attachment_count", &obj.NetworkAttachmentCount, UnmarshalInstanceProfileNetworkAttachmentCount)
if err != nil {
err = core.SDKErrorf(err, "", "network_attachment_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalInstanceProfileNetworkInterfaceCount)
if err != nil {
err = core.SDKErrorf(err, "", "network_interface_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "numa_count", &obj.NumaCount, UnmarshalInstanceProfileNumaCount)
if err != nil {
err = core.SDKErrorf(err, "", "numa_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalInstanceProfileOsArchitecture)
if err != nil {
err = core.SDKErrorf(err, "", "os_architecture-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "port_speed", &obj.PortSpeed, UnmarshalInstanceProfilePortSpeed)
if err != nil {
err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "reservation_terms", &obj.ReservationTerms, UnmarshalInstanceProfileReservationTerms)
if err != nil {
err = core.SDKErrorf(err, "", "reservation_terms-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "secure_boot_modes", &obj.SecureBootModes, UnmarshalInstanceProfileSupportedSecureBootModes)
if err != nil {
err = core.SDKErrorf(err, "", "secure_boot_modes-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "supported_cluster_network_profiles", &obj.SupportedClusterNetworkProfiles, UnmarshalClusterNetworkProfileReference)
if err != nil {
err = core.SDKErrorf(err, "", "supported_cluster_network_profiles-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth, UnmarshalInstanceProfileVolumeBandwidth)
if err != nil {
err = core.SDKErrorf(err, "", "total_volume_bandwidth-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalInstanceProfileVcpuArchitecture)
if err != nil {
err = core.SDKErrorf(err, "", "vcpu_architecture-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalInstanceProfileVcpu)
if err != nil {
err = core.SDKErrorf(err, "", "vcpu_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vcpu_manufacturer", &obj.VcpuManufacturer, UnmarshalInstanceProfileVcpuManufacturer)
if err != nil {
err = core.SDKErrorf(err, "", "vcpu_manufacturer-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceProfileClusterNetworkAttachmentCount : InstanceProfileClusterNetworkAttachmentCount struct
// Models which "extend" this model:
// - InstanceProfileClusterNetworkAttachmentCountDependent
// - InstanceProfileClusterNetworkAttachmentCountEnum
// - InstanceProfileClusterNetworkAttachmentCountRange
type InstanceProfileClusterNetworkAttachmentCount struct {
// The type for this profile field.
Type *string `json:"type,omitempty"`
Default *int64 `json:"default,omitempty"`
// The permitted values for this profile field.
Values []int64 `json:"values,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"`
Step *int64 `json:"step,omitempty"`
}
// Constants associated with the InstanceProfileClusterNetworkAttachmentCount.Type property.
// The type for this profile field.
const (
InstanceProfileClusterNetworkAttachmentCountTypeDependentConst = "dependent"
)
func (*InstanceProfileClusterNetworkAttachmentCount) isaInstanceProfileClusterNetworkAttachmentCount() bool {
return true
}
type InstanceProfileClusterNetworkAttachmentCountIntf interface {
isaInstanceProfileClusterNetworkAttachmentCount() bool
}
// UnmarshalInstanceProfileClusterNetworkAttachmentCount unmarshals an instance of InstanceProfileClusterNetworkAttachmentCount from the specified map of raw messages.
func UnmarshalInstanceProfileClusterNetworkAttachmentCount(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceProfileClusterNetworkAttachmentCount)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceProfileCollection : InstanceProfileCollection struct
type InstanceProfileCollection struct {
// A page 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 {
err = core.SDKErrorf(err, "", "profiles-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "quantity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalInstanceProfileDiskSize)
if err != nil {
err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalInstanceProfileDiskSupportedInterfaces)
if err != nil {
err = core.SDKErrorf(err, "", "supported_interface_types-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
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 may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceProfileGpu : InstanceProfileGpu struct
// Models which "extend" this model:
// - InstanceProfileGpuFixed
// - InstanceProfileGpuRange
// - InstanceProfileGpuEnum
// - InstanceProfileGpuDependent
type InstanceProfileGpu 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 InstanceProfileGpu.Type property.
// The type for this profile field.
const (
InstanceProfileGpuTypeFixedConst = "fixed"
)
func (*InstanceProfileGpu) isaInstanceProfileGpu() bool {
return true
}
type InstanceProfileGpuIntf interface {
isaInstanceProfileGpu() bool
}
// UnmarshalInstanceProfileGpu unmarshals an instance of InstanceProfileGpu from the specified map of raw messages.
func UnmarshalInstanceProfileGpu(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceProfileGpu)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceProfileGpuManufacturer : InstanceProfileGpuManufacturer struct
type InstanceProfileGpuManufacturer struct {
// The type for this profile field.
Type *string `json:"type" validate:"required"`
// The possible GPU manufacturer(s) for an instance with this profile.
Values []string `json:"values" validate:"required"`
}
// Constants associated with the InstanceProfileGpuManufacturer.Type property.
// The type for this profile field.
const (
InstanceProfileGpuManufacturerTypeEnumConst = "enum"
)
// Constants associated with the InstanceProfileGpuManufacturer.Values property.
// The GPU manufacturer.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
InstanceProfileGpuManufacturerValuesAmdConst = "amd"
InstanceProfileGpuManufacturerValuesIntelConst = "intel"
InstanceProfileGpuManufacturerValuesNvidiaConst = "nvidia"
)
// UnmarshalInstanceProfileGpuManufacturer unmarshals an instance of InstanceProfileGpuManufacturer from the specified map of raw messages.
func UnmarshalInstanceProfileGpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceProfileGpuManufacturer)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceProfileGpuMemory : InstanceProfileGpuMemory struct
// Models which "extend" this model:
// - InstanceProfileGpuMemoryFixed
// - InstanceProfileGpuMemoryRange
// - InstanceProfileGpuMemoryEnum
// - InstanceProfileGpuMemoryDependent
type InstanceProfileGpuMemory 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 InstanceProfileGpuMemory.Type property.
// The type for this profile field.
const (
InstanceProfileGpuMemoryTypeFixedConst = "fixed"
)
func (*InstanceProfileGpuMemory) isaInstanceProfileGpuMemory() bool {
return true
}
type InstanceProfileGpuMemoryIntf interface {
isaInstanceProfileGpuMemory() bool
}
// UnmarshalInstanceProfileGpuMemory unmarshals an instance of InstanceProfileGpuMemory from the specified map of raw messages.
func UnmarshalInstanceProfileGpuMemory(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceProfileGpuMemory)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceProfileGpuModel : InstanceProfileGpuModel struct
type InstanceProfileGpuModel struct {
// The type for this profile field.
Type *string `json:"type" validate:"required"`
// The possible GPU model(s) for an instance with this profile.
Values []string `json:"values" validate:"required"`
}
// Constants associated with the InstanceProfileGpuModel.Type property.
// The type for this profile field.
const (
InstanceProfileGpuModelTypeEnumConst = "enum"
)
// UnmarshalInstanceProfileGpuModel unmarshals an instance of InstanceProfileGpuModel from the specified map of raw messages.
func UnmarshalInstanceProfileGpuModel(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceProfileGpuModel)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceProfileNumaCount : InstanceProfileNumaCount struct
// Models which "extend" this model:
// - InstanceProfileNumaCountFixed
// - InstanceProfileNumaCountDependent
type InstanceProfileNumaCount 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 InstanceProfileNumaCount.Type property.
// The type for this profile field.
const (
InstanceProfileNumaCountTypeFixedConst = "fixed"
)
func (*InstanceProfileNumaCount) isaInstanceProfileNumaCount() bool {
return true
}
type InstanceProfileNumaCountIntf interface {
isaInstanceProfileNumaCount() bool
}
// UnmarshalInstanceProfileNumaCount unmarshals an instance of InstanceProfileNumaCount from the specified map of raw messages.
func UnmarshalInstanceProfileNumaCount(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceProfileNumaCount)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceProfileNetworkAttachmentCount : InstanceProfileNetworkAttachmentCount struct
// Models which "extend" this model:
// - InstanceProfileNetworkAttachmentCountRange
// - InstanceProfileNetworkAttachmentCountDependent
type InstanceProfileNetworkAttachmentCount struct {
// 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 type for this profile field.
Type *string `json:"type,omitempty"`
}
// Constants associated with the InstanceProfileNetworkAttachmentCount.Type property.
// The type for this profile field.
const (
InstanceProfileNetworkAttachmentCountTypeRangeConst = "range"
)
func (*InstanceProfileNetworkAttachmentCount) isaInstanceProfileNetworkAttachmentCount() bool {
return true
}
type InstanceProfileNetworkAttachmentCountIntf interface {
isaInstanceProfileNetworkAttachmentCount() bool
}
// UnmarshalInstanceProfileNetworkAttachmentCount unmarshals an instance of InstanceProfileNetworkAttachmentCount from the specified map of raw messages.
func UnmarshalInstanceProfileNetworkAttachmentCount(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceProfileNetworkAttachmentCount)
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceProfileNetworkInterfaceCount : InstanceProfileNetworkInterfaceCount struct
// Models which "extend" this model:
// - InstanceProfileNetworkInterfaceCountRange
// - InstanceProfileNetworkInterfaceCountDependent
type InstanceProfileNetworkInterfaceCount struct {
// 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 type for this profile field.
Type *string `json:"type,omitempty"`
}
// Constants associated with the InstanceProfileNetworkInterfaceCount.Type property.
// The type for this profile field.
const (
InstanceProfileNetworkInterfaceCountTypeRangeConst = "range"
)
func (*InstanceProfileNetworkInterfaceCount) isaInstanceProfileNetworkInterfaceCount() bool {
return true
}
type InstanceProfileNetworkInterfaceCountIntf interface {
isaInstanceProfileNetworkInterfaceCount() bool
}
// UnmarshalInstanceProfileNetworkInterfaceCount unmarshals an instance of InstanceProfileNetworkInterfaceCount from the specified map of raw messages.
func UnmarshalInstanceProfileNetworkInterfaceCount(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceProfileNetworkInterfaceCount)
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
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"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the InstanceProfileReference.ResourceType property.
// The resource type.
const (
InstanceProfileReferenceResourceTypeInstanceProfileConst = "instance_profile"
)
// 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 {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceProfileReservationTerms : InstanceProfileReservationTerms struct
type InstanceProfileReservationTerms struct {
// The type for this profile field.
Type *string `json:"type" validate:"required"`
// The supported committed use terms for a reservation using this profile.
Values []string `json:"values" validate:"required"`
}
// Constants associated with the InstanceProfileReservationTerms.Type property.
// The type for this profile field.
const (
InstanceProfileReservationTermsTypeEnumConst = "enum"
)
// Constants associated with the InstanceProfileReservationTerms.Values property.
const (
InstanceProfileReservationTermsValuesOneYearConst = "one_year"
InstanceProfileReservationTermsValuesThreeYearConst = "three_year"
)
// UnmarshalInstanceProfileReservationTerms unmarshals an instance of InstanceProfileReservationTerms from the specified map of raw messages.
func UnmarshalInstanceProfileReservationTerms(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceProfileReservationTerms)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceProfileSupportedConfidentialComputeModes : InstanceProfileSupportedConfidentialComputeModes struct
type InstanceProfileSupportedConfidentialComputeModes struct {
// The default confidential compute mode for this profile.
Default *string `json:"default" validate:"required"`
// The type for this profile field.
Type *string `json:"type" validate:"required"`
// The supported confidential compute modes.
Values []string `json:"values" validate:"required"`
}
// Constants associated with the InstanceProfileSupportedConfidentialComputeModes.Default property.
// The default confidential compute mode for this profile.
const (
InstanceProfileSupportedConfidentialComputeModesDefaultDisabledConst = "disabled"
InstanceProfileSupportedConfidentialComputeModesDefaultSgxConst = "sgx"
InstanceProfileSupportedConfidentialComputeModesDefaultTdxConst = "tdx"
)
// Constants associated with the InstanceProfileSupportedConfidentialComputeModes.Type property.
// The type for this profile field.
const (
InstanceProfileSupportedConfidentialComputeModesTypeEnumConst = "enum"
)
// Constants associated with the InstanceProfileSupportedConfidentialComputeModes.Values property.
// The confidential compute modes:
// - `disabled`: No confidential compute functionality
// - `sgx`: Intel Software Guard Extensions
// - `tdx`: Intel Trust Domain Extensions
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
InstanceProfileSupportedConfidentialComputeModesValuesDisabledConst = "disabled"
InstanceProfileSupportedConfidentialComputeModesValuesSgxConst = "sgx"
InstanceProfileSupportedConfidentialComputeModesValuesTdxConst = "tdx"
)
// UnmarshalInstanceProfileSupportedConfidentialComputeModes unmarshals an instance of InstanceProfileSupportedConfidentialComputeModes from the specified map of raw messages.
func UnmarshalInstanceProfileSupportedConfidentialComputeModes(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceProfileSupportedConfidentialComputeModes)
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceProfileSupportedSecureBootModes : InstanceProfileSupportedSecureBootModes struct
type InstanceProfileSupportedSecureBootModes struct {
// The default secure boot mode for this profile.
Default *bool `json:"default" validate:"required"`
// The type for this profile field.
Type *string `json:"type" validate:"required"`
// The supported `enable_secure_boot` values for an instance using this profile.
Values []bool `json:"values" validate:"required"`
}
// Constants associated with the InstanceProfileSupportedSecureBootModes.Type property.
// The type for this profile field.
const (
InstanceProfileSupportedSecureBootModesTypeEnumConst = "enum"
)
// UnmarshalInstanceProfileSupportedSecureBootModes unmarshals an instance of InstanceProfileSupportedSecureBootModes from the specified map of raw messages.
func UnmarshalInstanceProfileSupportedSecureBootModes(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceProfileSupportedSecureBootModes)
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceProfileVcpuArchitecture : InstanceProfileVcpuArchitecture struct
type InstanceProfileVcpuArchitecture struct {
// 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"
)
// Constants associated with the InstanceProfileVcpuArchitecture.Value property.
// The VCPU architecture for an instance with this profile.
const (
InstanceProfileVcpuArchitectureValueAmd64Const = "amd64"
InstanceProfileVcpuArchitectureValueS390xConst = "s390x"
)
// 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, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceProfileVcpuManufacturer : InstanceProfileVcpuManufacturer struct
// Models which "extend" this model:
// - InstanceProfileVcpuManufacturerFixed
// - InstanceProfileVcpuManufacturerDependent
type InstanceProfileVcpuManufacturer struct {
// The type for this profile field.
Type *string `json:"type,omitempty"`
// The VCPU manufacturer for an instance with this profile.
Value *string `json:"value,omitempty"`
}
// Constants associated with the InstanceProfileVcpuManufacturer.Type property.
// The type for this profile field.
const (
InstanceProfileVcpuManufacturerTypeFixedConst = "fixed"
)
// Constants associated with the InstanceProfileVcpuManufacturer.Value property.
// The VCPU manufacturer for an instance with this profile.
const (
InstanceProfileVcpuManufacturerValueAmdConst = "amd"
InstanceProfileVcpuManufacturerValueIBMConst = "ibm"
InstanceProfileVcpuManufacturerValueIntelConst = "intel"
)
func (*InstanceProfileVcpuManufacturer) isaInstanceProfileVcpuManufacturer() bool {
return true
}
type InstanceProfileVcpuManufacturerIntf interface {
isaInstanceProfileVcpuManufacturer() bool
}
// UnmarshalInstanceProfileVcpuManufacturer unmarshals an instance of InstanceProfileVcpuManufacturer from the specified map of raw messages.
func UnmarshalInstanceProfileVcpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceProfileVcpuManufacturer)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceProfileVolumeBandwidth : InstanceProfileVolumeBandwidth struct
// Models which "extend" this model:
// - InstanceProfileVolumeBandwidthFixed
// - InstanceProfileVolumeBandwidthRange
// - InstanceProfileVolumeBandwidthEnum
// - InstanceProfileVolumeBandwidthDependent
type InstanceProfileVolumeBandwidth 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 InstanceProfileVolumeBandwidth.Type property.
// The type for this profile field.
const (
InstanceProfileVolumeBandwidthTypeFixedConst = "fixed"
)
func (*InstanceProfileVolumeBandwidth) isaInstanceProfileVolumeBandwidth() bool {
return true
}
type InstanceProfileVolumeBandwidthIntf interface {
isaInstanceProfileVolumeBandwidth() bool
}
// UnmarshalInstanceProfileVolumeBandwidth unmarshals an instance of InstanceProfileVolumeBandwidth from the specified map of raw messages.
func UnmarshalInstanceProfileVolumeBandwidth(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceProfileVolumeBandwidth)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstancePrototype : InstancePrototype struct
// Models which "extend" this model:
// - InstancePrototypeInstanceByImage
// - InstancePrototypeInstanceByCatalogOffering
// - InstancePrototypeInstanceByVolume
// - InstancePrototypeInstanceBySourceSnapshot
// - InstancePrototypeInstanceBySourceTemplate
type InstancePrototype struct {
// The availability policy to use for this virtual server instance.
AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"`
// The cluster network attachments to create for this virtual server instance. A cluster network attachment represents
// a device that is connected to a cluster network. The number of network attachments must match one of the values from
// the instance profile's `cluster_network_attachment_count` before the instance can be started.
ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"`
// The confidential compute mode to use for this virtual server instance.
//
// If unspecified, the default confidential compute mode from the profile will be used.
ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"`
// The default trusted profile configuration to use for this virtual server instance
//
// This property's value is used when provisioning the virtual server instance, but not
// subsequently managed. Accordingly, it is reflected as an [instance
// initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization)
// property.
DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"`
// Indicates whether secure boot is enabled for this virtual server instance.
//
// If unspecified, the default secure boot mode from the profile will be used.
EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"`
// The public SSH keys for this virtual server instance. 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
// [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account).
//
// For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator
// password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if
// no keys are specified, the instance will be inaccessible unless the specified image provides another means of
// access.
//
// This property's value is used when provisioning the virtual server instance, but not subsequently managed.
// Accordingly, it is reflected as an [instance
// initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property.
Keys []KeyIdentityIntf `json:"keys,omitempty"`
// The metadata service configuration.
MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"`
// The name for this virtual server instance. The name must not be used by another virtual server instance in the
// region. If unspecified, the name will be a hyphenated list of randomly-selected words.
//
// The system hostname will be based on this name.
Name *string `json:"name,omitempty"`
// The placement restrictions to use for the virtual server instance.
//
// If specified, `reservation_affinity.policy` must be `disabled`.
PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"`
// The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this
// virtual server instance.
//
// If unspecified, `bx2-2x8` will be used, but this default value is expected to change
// in the future.
Profile InstanceProfileIdentityIntf `json:"profile,omitempty"`
// The reservation affinity settings for this virtual server instance. If specified,
// `vcpu.tenancy` must be `dedicated`, and `vcpu.percentage` must be `100`.
ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"`
// The resource group to use. If unspecified, the account's [default resource
// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in
// this value will result in a corresponding decrease to
// `total_network_bandwidth`.
TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"`
// The [user data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual
// server instance.
UserData *string `json:"user_data,omitempty"`
// The additional volume attachments to create for the virtual server instance.
VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"`
// The VPC this virtual server instance will reside in.
//
// If specified, it must match the VPC for the subnets of the instance network
// attachments or instance network interfaces.
VPC VPCIdentityIntf `json:"vpc,omitempty"`
// The boot volume attachment to create for the virtual server instance.
BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"`
// The image to use when provisioning the virtual server instance.
Image ImageIdentityIntf `json:"image,omitempty"`
// The zone this virtual server instance will reside in.
Zone ZoneIdentityIntf `json:"zone,omitempty"`
// The additional network attachments to create for the virtual server instance.
NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"`
// The primary network attachment to create for the virtual server instance.
PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"`
// The additional instance network interfaces to create.
NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"`
// The primary instance network interface to create.
PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"`
// The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering
// or offering version to use when provisioning this virtual server instance.
//
// If an offering is specified, the latest version of that offering will be used.
//
// The specified offering or offering version may be in a different account, subject
// to IAM policies.
CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"`
// The template to create this virtual server instance from.
SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"`
}
// Constants associated with the InstancePrototype.ConfidentialComputeMode property.
// The confidential compute mode to use for this virtual server instance.
//
// If unspecified, the default confidential compute mode from the profile will be used.
const (
InstancePrototypeConfidentialComputeModeDisabledConst = "disabled"
InstancePrototypeConfidentialComputeModeSgxConst = "sgx"
InstancePrototypeConfidentialComputeModeTdxConst = "tdx"
)
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, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext)
if err != nil {
err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode)
if err != nil {
err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot)
if err != nil {
err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "metadata_service-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "reservation_affinity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth)
if err != nil {
err = core.SDKErrorf(err, "", "total_volume_bandwidth-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData)
if err != nil {
err = core.SDKErrorf(err, "", "user_data-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext)
if err != nil {
err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "source_template-error", common.GetComponentInfo())
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 *Deleted `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 name for this virtual server instance. The name is unique across all virtual server instances in the region.
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 {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceReservationAffinity : InstanceReservationAffinity struct
type InstanceReservationAffinity struct {
// The reservation affinity policy to use for this virtual server instance:
// - `automatic`: Any reservations with an `affinity_policy` of `automatic`
// that have the same `profile` and `zone` as this virtual server instance
// are available for use.
// - `disabled`: Reservations will not be used
// - `manual`: Reservations in `pool` are available for use.
Policy *string `json:"policy" validate:"required"`
// The pool of reservations available for use by this virtual server instance when the `policy` is `manual`. This must
// be empty if the `policy` is `automatic` or
// `disabled`.
Pool []ReservationReference `json:"pool" validate:"required"`
}
// Constants associated with the InstanceReservationAffinity.Policy property.
// The reservation affinity policy to use for this virtual server instance:
// - `automatic`: Any reservations with an `affinity_policy` of `automatic`
// that have the same `profile` and `zone` as this virtual server instance
// are available for use.
// - `disabled`: Reservations will not be used
// - `manual`: Reservations in `pool` are available for use.
const (
InstanceReservationAffinityPolicyAutomaticConst = "automatic"
InstanceReservationAffinityPolicyDisabledConst = "disabled"
InstanceReservationAffinityPolicyManualConst = "manual"
)
// UnmarshalInstanceReservationAffinity unmarshals an instance of InstanceReservationAffinity from the specified map of raw messages.
func UnmarshalInstanceReservationAffinity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceReservationAffinity)
err = core.UnmarshalPrimitive(m, "policy", &obj.Policy)
if err != nil {
err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationReference)
if err != nil {
err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceReservationAffinityPatch : InstanceReservationAffinityPatch struct
type InstanceReservationAffinityPatch struct {
// The reservation affinity policy to use for this virtual server instance:
// - `automatic`: Any reservations with an `affinity_policy` of `automatic`
// that have the same `profile` and `zone` as this virtual server instance
// are available for use.
// - `disabled`: Reservations will not be used
// - `manual`: Reservations in `pool` will be available for use
//
// The policy must be `disabled` if `placement_target` is set.
Policy *string `json:"policy,omitempty"`
// The pool of reservations available for use by this virtual server instance, replacing the existing pool of
// reservations.
//
// Specified reservations must have a `status` of `active`, and have the same `profile` and `zone` as this virtual
// server instance.
//
// If `policy` is `manual`, `pool` must have one reservation. If `policy` is `disabled` or `automatic`, `pool` must be
// empty. If `policy` is `manual`, the `pool` must contain a reservation with available capacity.
Pool []ReservationIdentityIntf `json:"pool,omitempty"`
}
// Constants associated with the InstanceReservationAffinityPatch.Policy property.
// The reservation affinity policy to use for this virtual server instance:
// - `automatic`: Any reservations with an `affinity_policy` of `automatic`
// that have the same `profile` and `zone` as this virtual server instance
// are available for use.
// - `disabled`: Reservations will not be used
// - `manual`: Reservations in `pool` will be available for use
//
// The policy must be `disabled` if `placement_target` is set.
const (
InstanceReservationAffinityPatchPolicyAutomaticConst = "automatic"
InstanceReservationAffinityPatchPolicyDisabledConst = "disabled"
InstanceReservationAffinityPatchPolicyManualConst = "manual"
)
// UnmarshalInstanceReservationAffinityPatch unmarshals an instance of InstanceReservationAffinityPatch from the specified map of raw messages.
func UnmarshalInstanceReservationAffinityPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceReservationAffinityPatch)
err = core.UnmarshalPrimitive(m, "policy", &obj.Policy)
if err != nil {
err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the InstanceReservationAffinityPatch
func (instanceReservationAffinityPatch *InstanceReservationAffinityPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(instanceReservationAffinityPatch.Policy) {
_patch["policy"] = instanceReservationAffinityPatch.Policy
}
if !core.IsNil(instanceReservationAffinityPatch.Pool) {
var poolPatches []map[string]interface{}
for _, pool := range instanceReservationAffinityPatch.Pool {
poolPatches = append(poolPatches, pool.asPatch())
}
_patch["pool"] = poolPatches
}
return
}
// InstanceReservationAffinityPrototype : The reservation affinity settings for this virtual server instance. If specified,
// `vcpu.tenancy` must be `dedicated`, and `vcpu.percentage` must be `100`.
type InstanceReservationAffinityPrototype struct {
// The reservation affinity policy to use for this virtual server instance:
// - `disabled`: Reservations will not be used
// - `manual`: Reservations in `pool` will be available for use
// - `automatic`: Reservations with an `affinity_policy` of `automatic` that have the same
// `profile` and `zone` as this virtual server instance will be available for use.
//
// The policy will default to `manual` if `pool` is not empty. The policy will default to
// `disabled` if a `placement_target` is set. The policy will default to `automatic` in all other cases.
//
// The policy must be `disabled` if `placement_target` is specified.
Policy *string `json:"policy,omitempty"`
// The pool of reservations available for use by this virtual server instance.
//
// Specified reservations must have a `status` of `active`, and have the same `profile` and `zone` as this virtual
// server instance.
//
// If `policy` is `manual`, `pool` must be specified with one reservation. If `policy` is `disabled` or `automatic` and
// `pool` is specified, it must be empty. If `policy` is `manual`, the `pool` must contain a reservation with available
// capacity.
Pool []ReservationIdentityIntf `json:"pool,omitempty"`
}
// Constants associated with the InstanceReservationAffinityPrototype.Policy property.
// The reservation affinity policy to use for this virtual server instance:
// - `disabled`: Reservations will not be used
// - `manual`: Reservations in `pool` will be available for use
// - `automatic`: Reservations with an `affinity_policy` of `automatic` that have the same
// `profile` and `zone` as this virtual server instance will be available for use.
//
// The policy will default to `manual` if `pool` is not empty. The policy will default to
// `disabled` if a `placement_target` is set. The policy will default to `automatic` in all other cases.
//
// The policy must be `disabled` if `placement_target` is specified.
const (
InstanceReservationAffinityPrototypePolicyAutomaticConst = "automatic"
InstanceReservationAffinityPrototypePolicyDisabledConst = "disabled"
InstanceReservationAffinityPrototypePolicyManualConst = "manual"
)
// UnmarshalInstanceReservationAffinityPrototype unmarshals an instance of InstanceReservationAffinityPrototype from the specified map of raw messages.
func UnmarshalInstanceReservationAffinityPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceReservationAffinityPrototype)
err = core.UnmarshalPrimitive(m, "policy", &obj.Policy)
if err != nil {
err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceStatusReason : InstanceStatusReason struct
type InstanceStatusReason struct {
// A snake case string succinctly identifying the status reason.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the status reason.
Message *string `json:"message" validate:"required"`
// A link to documentation about this status reason.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the InstanceStatusReason.Code property.
// A snake case string succinctly identifying the status reason.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
InstanceStatusReasonCodeCannotStartConst = "cannot_start"
InstanceStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity"
InstanceStatusReasonCodeCannotStartComputeConst = "cannot_start_compute"
InstanceStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address"
InstanceStatusReasonCodeCannotStartNetworkConst = "cannot_start_network"
InstanceStatusReasonCodeCannotStartPlacementGroupConst = "cannot_start_placement_group"
InstanceStatusReasonCodeCannotStartReservationCapacityConst = "cannot_start_reservation_capacity"
InstanceStatusReasonCodeCannotStartReservationExpiredConst = "cannot_start_reservation_expired"
InstanceStatusReasonCodeCannotStartStorageConst = "cannot_start_storage"
InstanceStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted"
InstanceStatusReasonCodeStoppedByHostFailureConst = "stopped_by_host_failure"
InstanceStatusReasonCodeStoppedForImageCreationConst = "stopped_for_image_creation"
)
// UnmarshalInstanceStatusReason unmarshals an instance of InstanceStatusReason from the specified map of raw messages.
func UnmarshalInstanceStatusReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(InstanceStatusReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceTemplate : InstanceTemplate struct
// Models which "extend" this model:
// - InstanceTemplateInstanceByImageInstanceTemplateContext
// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext
// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext
type InstanceTemplate struct {
// The availability policy to use for this virtual server instance.
AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"`
// The cluster network attachments to create for this virtual server instance. A cluster network attachment represents
// a device that is connected to a cluster network. The number of network attachments must match one of the values from
// the instance profile's `cluster_network_attachment_count` before the instance can be started.
ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"`
// The confidential compute mode to use for this virtual server instance.
//
// If unspecified, the default confidential compute mode from the profile will be used.
ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"`
// 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 default trusted profile configuration to use for this virtual server instance
//
// This property's value is used when provisioning the virtual server instance, but not
// subsequently managed. Accordingly, it is reflected as an [instance
// initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization)
// property.
DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"`
// Indicates whether secure boot is enabled for this virtual server instance.
//
// If unspecified, the default secure boot mode from the profile will be used.
EnableSecureBoot *bool `json:"enable_secure_boot,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 public SSH keys for this virtual server instance. 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
// [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account).
//
// For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator
// password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if
// no keys are specified, the instance will be inaccessible unless the specified image provides another means of
// access.
//
// This property's value is used when provisioning the virtual server instance, but not subsequently managed.
// Accordingly, it is reflected as an [instance
// initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property.
Keys []KeyIdentityIntf `json:"keys,omitempty"`
// The metadata service configuration.
MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"`
// The name for this instance template. The name is unique across all instance templates in the region.
Name *string `json:"name" validate:"required"`
// The placement restrictions to use for the virtual server instance.
//
// If specified, `reservation_affinity.policy` must be `disabled`.
PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"`
// The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this
// virtual server instance.
//
// If unspecified, `bx2-2x8` will be used, but this default value is expected to change
// in the future.
Profile InstanceProfileIdentityIntf `json:"profile,omitempty"`
// The reservation affinity settings for this virtual server instance. If specified,
// `vcpu.tenancy` must be `dedicated`, and `vcpu.percentage` must be `100`.
ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"`
// The resource group for this instance template.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in
// this value will result in a corresponding decrease to
// `total_network_bandwidth`.
TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"`
// The [user data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual
// server instance.
UserData *string `json:"user_data,omitempty"`
// The additional volume attachments to create for the virtual server instance.
VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"`
// The VPC this virtual server instance will reside in.
//
// If specified, it must match the VPC for the subnets of the instance network
// attachments or instance network interfaces.
VPC VPCIdentityIntf `json:"vpc,omitempty"`
// The boot volume attachment to create for the virtual server instance.
BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"`
// The image to use when provisioning the virtual server instance.
Image ImageIdentityIntf `json:"image,omitempty"`
// The zone this virtual server instance will reside in.
Zone ZoneIdentityIntf `json:"zone,omitempty"`
// The additional network attachments to create for the virtual server instance.
NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"`
// The primary network attachment to create for the virtual server instance.
PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"`
// The additional instance network interfaces to create.
NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"`
// The primary instance network interface to create.
PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"`
// The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering
// or offering version to use when provisioning this virtual server instance.
//
// If an offering is specified, the latest version of that offering will be used.
//
// The specified offering or offering version may be in a different account, subject
// to IAM policies.
CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"`
}
// Constants associated with the InstanceTemplate.ConfidentialComputeMode property.
// The confidential compute mode to use for this virtual server instance.
//
// If unspecified, the default confidential compute mode from the profile will be used.
const (
InstanceTemplateConfidentialComputeModeDisabledConst = "disabled"
InstanceTemplateConfidentialComputeModeSgxConst = "sgx"
InstanceTemplateConfidentialComputeModeTdxConst = "tdx"
)
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) {
// Check for source_snapshot presence to determine object type
var isSourceSnapshot bool
if bootVolumeRaw, exists := m["boot_volume_attachment"]; exists && len(bootVolumeRaw) > 0 && string(bootVolumeRaw) != "null" {
var bootVolumeMap map[string]json.RawMessage
if err = json.Unmarshal(bootVolumeRaw, &bootVolumeMap); err == nil {
if volumeRaw, volumeExists := bootVolumeMap["volume"]; volumeExists && len(volumeRaw) > 0 && string(volumeRaw) != "null" {
var volumeMap map[string]json.RawMessage
if err = json.Unmarshal(volumeRaw, &volumeMap); err == nil {
if _, snapshotExists := volumeMap["source_snapshot"]; snapshotExists {
isSourceSnapshot = true
}
}
}
}
}
if isSourceSnapshot {
err = core.UnmarshalModel(m, "", result, UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext-error", common.GetComponentInfo())
}
return
} else {
obj := new(InstanceTemplate)
err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext)
if err != nil {
err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode)
if err != nil {
err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot)
if err != nil {
err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "metadata_service-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "reservation_affinity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth)
if err != nil {
err = core.SDKErrorf(err, "", "total_volume_bandwidth-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData)
if err != nil {
err = core.SDKErrorf(err, "", "user_data-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext)
if err != nil {
err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo())
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 *PageLink `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 *PageLink `json:"next,omitempty"`
// A page 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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "templates", &obj.Templates, UnmarshalInstanceTemplate)
if err != nil {
err = core.SDKErrorf(err, "", "templates-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
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
asPatch() map[string]interface{}
}
// 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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the InstanceTemplateIdentity
func (instanceTemplateIdentity *InstanceTemplateIdentity) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(instanceTemplateIdentity.ID) {
_patch["id"] = instanceTemplateIdentity.ID
}
if !core.IsNil(instanceTemplateIdentity.Href) {
_patch["href"] = instanceTemplateIdentity.Href
}
if !core.IsNil(instanceTemplateIdentity.CRN) {
_patch["crn"] = instanceTemplateIdentity.CRN
}
return
}
// InstanceTemplatePatch : InstanceTemplatePatch struct
type InstanceTemplatePatch struct {
// The name for this instance template. The name must not be used by another instance template in the region.
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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(instanceTemplatePatch.Name) {
_patch["name"] = instanceTemplatePatch.Name
}
return
}
// InstanceTemplatePrototype : InstanceTemplatePrototype struct
// Models which "extend" this model:
// - InstanceTemplatePrototypeInstanceTemplateByImage
// - InstanceTemplatePrototypeInstanceTemplateBySourceTemplate
// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot
// - InstanceTemplatePrototypeInstanceTemplateByCatalogOffering
type InstanceTemplatePrototype struct {
// The availability policy to use for this virtual server instance.
AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"`
// The cluster network attachments to create for this virtual server instance. A cluster network attachment represents
// a device that is connected to a cluster network. The number of network attachments must match one of the values from
// the instance profile's `cluster_network_attachment_count` before the instance can be started.
ClusterNetworkAttachments []InstanceClusterNetworkAttachmentPrototypeInstanceContext `json:"cluster_network_attachments,omitempty"`
// The confidential compute mode to use for this virtual server instance.
//
// If unspecified, the default confidential compute mode from the profile will be used.
ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"`
// The default trusted profile configuration to use for this virtual server instance
//
// This property's value is used when provisioning the virtual server instance, but not
// subsequently managed. Accordingly, it is reflected as an [instance
// initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization)
// property.
DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"`
// Indicates whether secure boot is enabled for this virtual server instance.
//
// If unspecified, the default secure boot mode from the profile will be used.
EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"`
// The public SSH keys for this virtual server instance. 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
// [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account).
//
// For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator
// password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys are optional for other images, but if
// no keys are specified, the instance will be inaccessible unless the specified image provides another means of
// access.
//
// This property's value is used when provisioning the virtual server instance, but not subsequently managed.
// Accordingly, it is reflected as an [instance
// initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property.
Keys []KeyIdentityIntf `json:"keys,omitempty"`
// The metadata service configuration.
MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"`
// The name for this instance template. The name must not be used by another instance template in the region. If
// unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The placement restrictions to use for the virtual server instance.
//
// If specified, `reservation_affinity.policy` must be `disabled`.
PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"`
// The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this
// virtual server instance.
//
// If unspecified, `bx2-2x8` will be used, but this default value is expected to change
// in the future.
Profile InstanceProfileIdentityIntf `json:"profile,omitempty"`
// The reservation affinity settings for this virtual server instance. If specified,
// `vcpu.tenancy` must be `dedicated`, and `vcpu.percentage` must be `100`.
ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"`
// The resource group to use. If unspecified, the account's [default resource
// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in
// this value will result in a corresponding decrease to
// `total_network_bandwidth`.
TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"`
// The [user data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual
// server instance.
UserData *string `json:"user_data,omitempty"`
// The additional volume attachments to create for the virtual server instance.
VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"`
// The VPC this virtual server instance will reside in.
//
// If specified, it must match the VPC for the subnets of the instance network
// attachments or instance network interfaces.
VPC VPCIdentityIntf `json:"vpc,omitempty"`
// The boot volume attachment to create for the virtual server instance.
BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"`
// The image to use when provisioning the virtual server instance.
Image ImageIdentityIntf `json:"image,omitempty"`
// The zone this virtual server instance will reside in.
Zone ZoneIdentityIntf `json:"zone,omitempty"`
// The additional network attachments to create for the virtual server instance.
NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"`
// The primary network attachment to create for the virtual server instance.
PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"`
// The additional instance network interfaces to create.
NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"`
// The primary instance network interface to create.
PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"`
// The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user)
// offering version to use when provisioning this virtual server instance.
// If an offering is specified, the latest version of that offering will be used.
//
// The specified offering or offering version may be in a different account, subject to
// IAM policies.
//
// If specified, `image` must not be specified, and `source_template` must not have
// `image` specified.
CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"`
// The template to create this virtual server instance from.
SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"`
}
// Constants associated with the InstanceTemplatePrototype.ConfidentialComputeMode property.
// The confidential compute mode to use for this virtual server instance.
//
// If unspecified, the default confidential compute mode from the profile will be used.
const (
InstanceTemplatePrototypeConfidentialComputeModeDisabledConst = "disabled"
InstanceTemplatePrototypeConfidentialComputeModeSgxConst = "sgx"
InstanceTemplatePrototypeConfidentialComputeModeTdxConst = "tdx"
)
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, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "cluster_network_attachments", &obj.ClusterNetworkAttachments, UnmarshalInstanceClusterNetworkAttachmentPrototypeInstanceContext)
if err != nil {
err = core.SDKErrorf(err, "", "cluster_network_attachments-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "confidential_compute_mode", &obj.ConfidentialComputeMode)
if err != nil {
err = core.SDKErrorf(err, "", "confidential_compute_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot)
if err != nil {
err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "metadata_service-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "reservation_affinity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth)
if err != nil {
err = core.SDKErrorf(err, "", "total_volume_bandwidth-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData)
if err != nil {
err = core.SDKErrorf(err, "", "user_data-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext)
if err != nil {
err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "source_template-error", common.GetComponentInfo())
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 *Deleted `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 name for this instance template. The name is unique across all instance templates in the region.
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 {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// InstanceVcpu : The virtual server instance VCPU configuration.
type InstanceVcpu struct {
// The VCPU architecture.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Architecture *string `json:"architecture" validate:"required"`
// The number of VCPUs assigned.
Count *int64 `json:"count" validate:"required"`
// The VCPU manufacturer.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Manufacturer *string `json:"manufacturer" validate:"required"`
}
// Constants associated with the InstanceVcpu.Architecture property.
// The VCPU architecture.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
InstanceVcpuArchitectureAmd64Const = "amd64"
InstanceVcpuArchitectureS390xConst = "s390x"
)
// Constants associated with the InstanceVcpu.Manufacturer property.
// The VCPU manufacturer.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
InstanceVcpuManufacturerAmdConst = "amd"
InstanceVcpuManufacturerIBMConst = "ibm"
InstanceVcpuManufacturerIntelConst = "intel"
)
// 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 {
err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "count", &obj.Count)
if err != nil {
err = core.SDKErrorf(err, "", "count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer)
if err != nil {
err = core.SDKErrorf(err, "", "manufacturer-error", common.GetComponentInfo())
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 (such as
// `SHA256`).
//
// The length of this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 name for this key. The name must not be used by another key in the region. If unspecified, the name will be a
// hyphenated list of randomly-selected words.
Name *string `json:"name" validate:"required"`
// The public SSH key, consisting of two space-separated fields: the algorithm name, and the base64-encoded key.
PublicKey *string `json:"public_key" validate:"required"`
// The resource group for this key.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The crypto-system for this key.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Type *string `json:"type" validate:"required"`
}
// Constants associated with the Key.Type property.
// The crypto-system for this key.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
KeyTypeEd25519Const = "ed25519"
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 {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint)
if err != nil {
err = core.SDKErrorf(err, "", "fingerprint-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "length", &obj.Length)
if err != nil {
err = core.SDKErrorf(err, "", "length-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "public_key", &obj.PublicKey)
if err != nil {
err = core.SDKErrorf(err, "", "public_key-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// KeyCollection : KeyCollection struct
type KeyCollection struct {
// A link to the first page of resources.
First *PageLink `json:"first" validate:"required"`
// A page of keys.
Keys []Key `json:"keys" 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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" 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, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKey)
if err != nil {
err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *KeyCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// KeyIdentity : Identifies a key by a unique property.
// Models which "extend" this model:
// - KeyIdentityByID
// - KeyIdentityByCRN
// - KeyIdentityByHref
// - KeyIdentityByFingerprint
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 (such as
// `SHA256`).
//
// The length of this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint)
if err != nil {
err = core.SDKErrorf(err, "", "fingerprint-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// KeyPatch : KeyPatch struct
type KeyPatch struct {
// The name for this key. The name must not be used by another key in the region.
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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(keyPatch.Name) {
_patch["name"] = keyPatch.Name
}
return
}
// KeyReference : KeyReference struct
type KeyReference 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 *Deleted `json:"deleted,omitempty"`
// The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (such as
// `SHA256`).
//
// The length of this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 name for this key. The name is unique across all keys in the region.
Name *string `json:"name" validate:"required"`
}
// UnmarshalKeyReference unmarshals an instance of KeyReference from the specified map of raw messages.
func UnmarshalKeyReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(KeyReference)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint)
if err != nil {
err = core.SDKErrorf(err, "", "fingerprint-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LegacyCloudObjectStorageBucketIdentity : Identifies a Cloud Object Storage bucket by a unique property.
// Models which "extend" this model:
// - LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName
type LegacyCloudObjectStorageBucketIdentity struct {
// The globally unique name of this Cloud Object Storage bucket.
Name *string `json:"name,omitempty"`
}
func (*LegacyCloudObjectStorageBucketIdentity) isaLegacyCloudObjectStorageBucketIdentity() bool {
return true
}
type LegacyCloudObjectStorageBucketIdentityIntf interface {
isaLegacyCloudObjectStorageBucketIdentity() bool
}
// UnmarshalLegacyCloudObjectStorageBucketIdentity unmarshals an instance of LegacyCloudObjectStorageBucketIdentity from the specified map of raw messages.
func UnmarshalLegacyCloudObjectStorageBucketIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LegacyCloudObjectStorageBucketIdentity)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LegacyCloudObjectStorageBucketReference : LegacyCloudObjectStorageBucketReference struct
type LegacyCloudObjectStorageBucketReference struct {
// The globally unique name of this Cloud Object Storage bucket.
Name *string `json:"name" validate:"required"`
}
// UnmarshalLegacyCloudObjectStorageBucketReference unmarshals an instance of LegacyCloudObjectStorageBucketReference from the specified map of raw messages.
func UnmarshalLegacyCloudObjectStorageBucketReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LegacyCloudObjectStorageBucketReference)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ListBackupPoliciesOptions : The ListBackupPolicies options.
type ListBackupPoliciesOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// Filters the collection to resources with an item in the `tags` property matching the exact specified tag.
Tag *string `json:"tag,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListBackupPoliciesOptions : Instantiate ListBackupPoliciesOptions
func (*VpcV1) NewListBackupPoliciesOptions() *ListBackupPoliciesOptions {
return &ListBackupPoliciesOptions{}
}
// SetStart : Allow user to set Start
func (_options *ListBackupPoliciesOptions) SetStart(start string) *ListBackupPoliciesOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListBackupPoliciesOptions) SetLimit(limit int64) *ListBackupPoliciesOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetResourceGroupID : Allow user to set ResourceGroupID
func (_options *ListBackupPoliciesOptions) SetResourceGroupID(resourceGroupID string) *ListBackupPoliciesOptions {
_options.ResourceGroupID = core.StringPtr(resourceGroupID)
return _options
}
// SetName : Allow user to set Name
func (_options *ListBackupPoliciesOptions) SetName(name string) *ListBackupPoliciesOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetTag : Allow user to set Tag
func (_options *ListBackupPoliciesOptions) SetTag(tag string) *ListBackupPoliciesOptions {
_options.Tag = core.StringPtr(tag)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListBackupPoliciesOptions) SetHeaders(param map[string]string) *ListBackupPoliciesOptions {
options.Headers = param
return options
}
// ListBackupPolicyJobsOptions : The ListBackupPolicyJobs options.
type ListBackupPolicyJobsOptions struct {
// The backup policy identifier.
BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="`
// Filters the collection to backup policy jobs with a `status` property matching the specified value.
Status *string `json:"status,omitempty"`
// Filters the collection to backup policy jobs with a `backup_policy_plan.id` property matching the specified
// identifier.
BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
Sort *string `json:"sort,omitempty"`
// Filters the collection to backup policy jobs with a `source.id` property matching the specified identifier.
SourceID *string `json:"source.id,omitempty"`
// Filters the collection to backup policy jobs with an item in the `target_snapshots` property with an `id` property
// matching the specified identifier.
TargetSnapshotsID *string `json:"target_snapshots[].id,omitempty"`
// Filters the collection to backup policy jobs with an item in the `target_snapshots` property with a `crn` property
// matching the specified CRN.
TargetSnapshotsCRN *string `json:"target_snapshots[].crn,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListBackupPolicyJobsOptions.Status property.
// Filters the collection to backup policy jobs with a `status` property matching the specified value.
const (
ListBackupPolicyJobsOptionsStatusFailedConst = "failed"
ListBackupPolicyJobsOptionsStatusRunningConst = "running"
ListBackupPolicyJobsOptionsStatusSucceededConst = "succeeded"
)
// Constants associated with the ListBackupPolicyJobsOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
const (
ListBackupPolicyJobsOptionsSortCreatedAtConst = "created_at"
ListBackupPolicyJobsOptionsSortNameConst = "name"
)
// NewListBackupPolicyJobsOptions : Instantiate ListBackupPolicyJobsOptions
func (*VpcV1) NewListBackupPolicyJobsOptions(backupPolicyID string) *ListBackupPolicyJobsOptions {
return &ListBackupPolicyJobsOptions{
BackupPolicyID: core.StringPtr(backupPolicyID),
}
}
// SetBackupPolicyID : Allow user to set BackupPolicyID
func (_options *ListBackupPolicyJobsOptions) SetBackupPolicyID(backupPolicyID string) *ListBackupPolicyJobsOptions {
_options.BackupPolicyID = core.StringPtr(backupPolicyID)
return _options
}
// SetStatus : Allow user to set Status
func (_options *ListBackupPolicyJobsOptions) SetStatus(status string) *ListBackupPolicyJobsOptions {
_options.Status = core.StringPtr(status)
return _options
}
// SetBackupPolicyPlanID : Allow user to set BackupPolicyPlanID
func (_options *ListBackupPolicyJobsOptions) SetBackupPolicyPlanID(backupPolicyPlanID string) *ListBackupPolicyJobsOptions {
_options.BackupPolicyPlanID = core.StringPtr(backupPolicyPlanID)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListBackupPolicyJobsOptions) SetStart(start string) *ListBackupPolicyJobsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListBackupPolicyJobsOptions) SetLimit(limit int64) *ListBackupPolicyJobsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetSort : Allow user to set Sort
func (_options *ListBackupPolicyJobsOptions) SetSort(sort string) *ListBackupPolicyJobsOptions {
_options.Sort = core.StringPtr(sort)
return _options
}
// SetSourceID : Allow user to set SourceID
func (_options *ListBackupPolicyJobsOptions) SetSourceID(sourceID string) *ListBackupPolicyJobsOptions {
_options.SourceID = core.StringPtr(sourceID)
return _options
}
// SetTargetSnapshotsID : Allow user to set TargetSnapshotsID
func (_options *ListBackupPolicyJobsOptions) SetTargetSnapshotsID(targetSnapshotsID string) *ListBackupPolicyJobsOptions {
_options.TargetSnapshotsID = core.StringPtr(targetSnapshotsID)
return _options
}
// SetTargetSnapshotsCRN : Allow user to set TargetSnapshotsCRN
func (_options *ListBackupPolicyJobsOptions) SetTargetSnapshotsCRN(targetSnapshotsCRN string) *ListBackupPolicyJobsOptions {
_options.TargetSnapshotsCRN = core.StringPtr(targetSnapshotsCRN)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListBackupPolicyJobsOptions) SetHeaders(param map[string]string) *ListBackupPolicyJobsOptions {
options.Headers = param
return options
}
// ListBackupPolicyPlansOptions : The ListBackupPolicyPlans options.
type ListBackupPolicyPlansOptions struct {
// The backup policy identifier.
BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListBackupPolicyPlansOptions : Instantiate ListBackupPolicyPlansOptions
func (*VpcV1) NewListBackupPolicyPlansOptions(backupPolicyID string) *ListBackupPolicyPlansOptions {
return &ListBackupPolicyPlansOptions{
BackupPolicyID: core.StringPtr(backupPolicyID),
}
}
// SetBackupPolicyID : Allow user to set BackupPolicyID
func (_options *ListBackupPolicyPlansOptions) SetBackupPolicyID(backupPolicyID string) *ListBackupPolicyPlansOptions {
_options.BackupPolicyID = core.StringPtr(backupPolicyID)
return _options
}
// SetName : Allow user to set Name
func (_options *ListBackupPolicyPlansOptions) SetName(name string) *ListBackupPolicyPlansOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListBackupPolicyPlansOptions) SetHeaders(param map[string]string) *ListBackupPolicyPlansOptions {
options.Headers = param
return options
}
// ListBareMetalServerDisksOptions : The ListBareMetalServerDisks options.
type ListBareMetalServerDisksOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListBareMetalServerDisksOptions : Instantiate ListBareMetalServerDisksOptions
func (*VpcV1) NewListBareMetalServerDisksOptions(bareMetalServerID string) *ListBareMetalServerDisksOptions {
return &ListBareMetalServerDisksOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *ListBareMetalServerDisksOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerDisksOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListBareMetalServerDisksOptions) SetHeaders(param map[string]string) *ListBareMetalServerDisksOptions {
options.Headers = param
return options
}
// ListBareMetalServerNetworkAttachmentsOptions : The ListBareMetalServerNetworkAttachments options.
type ListBareMetalServerNetworkAttachmentsOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListBareMetalServerNetworkAttachmentsOptions : Instantiate ListBareMetalServerNetworkAttachmentsOptions
func (*VpcV1) NewListBareMetalServerNetworkAttachmentsOptions(bareMetalServerID string) *ListBareMetalServerNetworkAttachmentsOptions {
return &ListBareMetalServerNetworkAttachmentsOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkAttachmentsOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetStart(start string) *ListBareMetalServerNetworkAttachmentsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetLimit(limit int64) *ListBareMetalServerNetworkAttachmentsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListBareMetalServerNetworkAttachmentsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkAttachmentsOptions {
options.Headers = param
return options
}
// ListBareMetalServerNetworkInterfaceFloatingIpsOptions : The ListBareMetalServerNetworkInterfaceFloatingIps options.
type ListBareMetalServerNetworkInterfaceFloatingIpsOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// The bare metal server network interface identifier.
NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListBareMetalServerNetworkInterfaceFloatingIpsOptions : Instantiate ListBareMetalServerNetworkInterfaceFloatingIpsOptions
func (*VpcV1) NewListBareMetalServerNetworkInterfaceFloatingIpsOptions(bareMetalServerID string, networkInterfaceID string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions {
return &ListBareMetalServerNetworkInterfaceFloatingIpsOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
NetworkInterfaceID: core.StringPtr(networkInterfaceID),
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID
func (_options *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions {
_options.NetworkInterfaceID = core.StringPtr(networkInterfaceID)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions {
options.Headers = param
return options
}
// ListBareMetalServerNetworkInterfaceIpsOptions : The ListBareMetalServerNetworkInterfaceIps options.
type ListBareMetalServerNetworkInterfaceIpsOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// The bare metal server network interface identifier.
NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListBareMetalServerNetworkInterfaceIpsOptions : Instantiate ListBareMetalServerNetworkInterfaceIpsOptions
func (*VpcV1) NewListBareMetalServerNetworkInterfaceIpsOptions(bareMetalServerID string, networkInterfaceID string) *ListBareMetalServerNetworkInterfaceIpsOptions {
return &ListBareMetalServerNetworkInterfaceIpsOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
NetworkInterfaceID: core.StringPtr(networkInterfaceID),
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *ListBareMetalServerNetworkInterfaceIpsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfaceIpsOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID
func (_options *ListBareMetalServerNetworkInterfaceIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListBareMetalServerNetworkInterfaceIpsOptions {
_options.NetworkInterfaceID = core.StringPtr(networkInterfaceID)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListBareMetalServerNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfaceIpsOptions {
options.Headers = param
return options
}
// ListBareMetalServerNetworkInterfacesOptions : The ListBareMetalServerNetworkInterfaces options.
type ListBareMetalServerNetworkInterfacesOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListBareMetalServerNetworkInterfacesOptions : Instantiate ListBareMetalServerNetworkInterfacesOptions
func (*VpcV1) NewListBareMetalServerNetworkInterfacesOptions(bareMetalServerID string) *ListBareMetalServerNetworkInterfacesOptions {
return &ListBareMetalServerNetworkInterfacesOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *ListBareMetalServerNetworkInterfacesOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfacesOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListBareMetalServerNetworkInterfacesOptions) SetStart(start string) *ListBareMetalServerNetworkInterfacesOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListBareMetalServerNetworkInterfacesOptions) SetLimit(limit int64) *ListBareMetalServerNetworkInterfacesOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListBareMetalServerNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfacesOptions {
options.Headers = param
return options
}
// ListBareMetalServerProfilesOptions : The ListBareMetalServerProfiles options.
type ListBareMetalServerProfilesOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListBareMetalServerProfilesOptions : Instantiate ListBareMetalServerProfilesOptions
func (*VpcV1) NewListBareMetalServerProfilesOptions() *ListBareMetalServerProfilesOptions {
return &ListBareMetalServerProfilesOptions{}
}
// SetStart : Allow user to set Start
func (_options *ListBareMetalServerProfilesOptions) SetStart(start string) *ListBareMetalServerProfilesOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListBareMetalServerProfilesOptions) SetLimit(limit int64) *ListBareMetalServerProfilesOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListBareMetalServerProfilesOptions) SetHeaders(param map[string]string) *ListBareMetalServerProfilesOptions {
options.Headers = param
return options
}
// ListBareMetalServersOptions : The ListBareMetalServers options.
type ListBareMetalServersOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// Filters the collection to resources with a `reservation.id` property matching the specified identifier.
ReservationID *string `json:"reservation.id,omitempty"`
// Filters the collection to resources with a `reservation.crn` property matching the specified identifier.
ReservationCRN *string `json:"reservation.crn,omitempty"`
// Filters the collection to resources with a `reservation.name` property matching the specified identifier.
ReservationName *string `json:"reservation.name,omitempty"`
// Filters the collection to resources with a `vpc.id` property matching the specified identifier.
VPCID *string `json:"vpc.id,omitempty"`
// Filters the collection to resources with a `vpc.crn` property matching the specified CRN.
VPCCRN *string `json:"vpc.crn,omitempty"`
// Filters the collection to resources with a `vpc.name` property matching the exact specified name.
VPCName *string `json:"vpc.name,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListBareMetalServersOptions : Instantiate ListBareMetalServersOptions
func (*VpcV1) NewListBareMetalServersOptions() *ListBareMetalServersOptions {
return &ListBareMetalServersOptions{}
}
// SetStart : Allow user to set Start
func (_options *ListBareMetalServersOptions) SetStart(start string) *ListBareMetalServersOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListBareMetalServersOptions) SetLimit(limit int64) *ListBareMetalServersOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetResourceGroupID : Allow user to set ResourceGroupID
func (_options *ListBareMetalServersOptions) SetResourceGroupID(resourceGroupID string) *ListBareMetalServersOptions {
_options.ResourceGroupID = core.StringPtr(resourceGroupID)
return _options
}
// SetName : Allow user to set Name
func (_options *ListBareMetalServersOptions) SetName(name string) *ListBareMetalServersOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetReservationID : Allow user to set ReservationID
func (_options *ListBareMetalServersOptions) SetReservationID(reservationID string) *ListBareMetalServersOptions {
_options.ReservationID = core.StringPtr(reservationID)
return _options
}
// SetReservationCRN : Allow user to set ReservationCRN
func (_options *ListBareMetalServersOptions) SetReservationCRN(reservationCRN string) *ListBareMetalServersOptions {
_options.ReservationCRN = core.StringPtr(reservationCRN)
return _options
}
// SetReservationName : Allow user to set ReservationName
func (_options *ListBareMetalServersOptions) SetReservationName(reservationName string) *ListBareMetalServersOptions {
_options.ReservationName = core.StringPtr(reservationName)
return _options
}
// SetVPCID : Allow user to set VPCID
func (_options *ListBareMetalServersOptions) SetVPCID(vpcID string) *ListBareMetalServersOptions {
_options.VPCID = core.StringPtr(vpcID)
return _options
}
// SetVPCCRN : Allow user to set VPCCRN
func (_options *ListBareMetalServersOptions) SetVPCCRN(vpcCRN string) *ListBareMetalServersOptions {
_options.VPCCRN = core.StringPtr(vpcCRN)
return _options
}
// SetVPCName : Allow user to set VPCName
func (_options *ListBareMetalServersOptions) SetVPCName(vpcName string) *ListBareMetalServersOptions {
_options.VPCName = core.StringPtr(vpcName)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListBareMetalServersOptions) SetHeaders(param map[string]string) *ListBareMetalServersOptions {
options.Headers = param
return options
}
// ListClusterNetworkInterfacesOptions : The ListClusterNetworkInterfaces options.
type ListClusterNetworkInterfacesOptions struct {
// The cluster network identifier.
ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
Sort *string `json:"sort,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListClusterNetworkInterfacesOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
const (
ListClusterNetworkInterfacesOptionsSortCreatedAtConst = "created_at"
ListClusterNetworkInterfacesOptionsSortNameConst = "name"
)
// NewListClusterNetworkInterfacesOptions : Instantiate ListClusterNetworkInterfacesOptions
func (*VpcV1) NewListClusterNetworkInterfacesOptions(clusterNetworkID string) *ListClusterNetworkInterfacesOptions {
return &ListClusterNetworkInterfacesOptions{
ClusterNetworkID: core.StringPtr(clusterNetworkID),
}
}
// SetClusterNetworkID : Allow user to set ClusterNetworkID
func (_options *ListClusterNetworkInterfacesOptions) SetClusterNetworkID(clusterNetworkID string) *ListClusterNetworkInterfacesOptions {
_options.ClusterNetworkID = core.StringPtr(clusterNetworkID)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListClusterNetworkInterfacesOptions) SetStart(start string) *ListClusterNetworkInterfacesOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListClusterNetworkInterfacesOptions) SetLimit(limit int64) *ListClusterNetworkInterfacesOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetName : Allow user to set Name
func (_options *ListClusterNetworkInterfacesOptions) SetName(name string) *ListClusterNetworkInterfacesOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetSort : Allow user to set Sort
func (_options *ListClusterNetworkInterfacesOptions) SetSort(sort string) *ListClusterNetworkInterfacesOptions {
_options.Sort = core.StringPtr(sort)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListClusterNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListClusterNetworkInterfacesOptions {
options.Headers = param
return options
}
// ListClusterNetworkProfilesOptions : The ListClusterNetworkProfiles options.
type ListClusterNetworkProfilesOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListClusterNetworkProfilesOptions : Instantiate ListClusterNetworkProfilesOptions
func (*VpcV1) NewListClusterNetworkProfilesOptions() *ListClusterNetworkProfilesOptions {
return &ListClusterNetworkProfilesOptions{}
}
// SetStart : Allow user to set Start
func (_options *ListClusterNetworkProfilesOptions) SetStart(start string) *ListClusterNetworkProfilesOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListClusterNetworkProfilesOptions) SetLimit(limit int64) *ListClusterNetworkProfilesOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListClusterNetworkProfilesOptions) SetHeaders(param map[string]string) *ListClusterNetworkProfilesOptions {
options.Headers = param
return options
}
// ListClusterNetworkSubnetReservedIpsOptions : The ListClusterNetworkSubnetReservedIps options.
type ListClusterNetworkSubnetReservedIpsOptions struct {
// The cluster network identifier.
ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="`
// The cluster network subnet identifier.
ClusterNetworkSubnetID *string `json:"cluster_network_subnet_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
Sort *string `json:"sort,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListClusterNetworkSubnetReservedIpsOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
const (
ListClusterNetworkSubnetReservedIpsOptionsSortAddressConst = "address"
ListClusterNetworkSubnetReservedIpsOptionsSortCreatedAtConst = "created_at"
ListClusterNetworkSubnetReservedIpsOptionsSortNameConst = "name"
)
// NewListClusterNetworkSubnetReservedIpsOptions : Instantiate ListClusterNetworkSubnetReservedIpsOptions
func (*VpcV1) NewListClusterNetworkSubnetReservedIpsOptions(clusterNetworkID string, clusterNetworkSubnetID string) *ListClusterNetworkSubnetReservedIpsOptions {
return &ListClusterNetworkSubnetReservedIpsOptions{
ClusterNetworkID: core.StringPtr(clusterNetworkID),
ClusterNetworkSubnetID: core.StringPtr(clusterNetworkSubnetID),
}
}
// SetClusterNetworkID : Allow user to set ClusterNetworkID
func (_options *ListClusterNetworkSubnetReservedIpsOptions) SetClusterNetworkID(clusterNetworkID string) *ListClusterNetworkSubnetReservedIpsOptions {
_options.ClusterNetworkID = core.StringPtr(clusterNetworkID)
return _options
}
// SetClusterNetworkSubnetID : Allow user to set ClusterNetworkSubnetID
func (_options *ListClusterNetworkSubnetReservedIpsOptions) SetClusterNetworkSubnetID(clusterNetworkSubnetID string) *ListClusterNetworkSubnetReservedIpsOptions {
_options.ClusterNetworkSubnetID = core.StringPtr(clusterNetworkSubnetID)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListClusterNetworkSubnetReservedIpsOptions) SetStart(start string) *ListClusterNetworkSubnetReservedIpsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListClusterNetworkSubnetReservedIpsOptions) SetLimit(limit int64) *ListClusterNetworkSubnetReservedIpsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetName : Allow user to set Name
func (_options *ListClusterNetworkSubnetReservedIpsOptions) SetName(name string) *ListClusterNetworkSubnetReservedIpsOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetSort : Allow user to set Sort
func (_options *ListClusterNetworkSubnetReservedIpsOptions) SetSort(sort string) *ListClusterNetworkSubnetReservedIpsOptions {
_options.Sort = core.StringPtr(sort)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListClusterNetworkSubnetReservedIpsOptions) SetHeaders(param map[string]string) *ListClusterNetworkSubnetReservedIpsOptions {
options.Headers = param
return options
}
// ListClusterNetworkSubnetsOptions : The ListClusterNetworkSubnets options.
type ListClusterNetworkSubnetsOptions struct {
// The cluster network identifier.
ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
Sort *string `json:"sort,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListClusterNetworkSubnetsOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
const (
ListClusterNetworkSubnetsOptionsSortCreatedAtConst = "created_at"
ListClusterNetworkSubnetsOptionsSortNameConst = "name"
)
// NewListClusterNetworkSubnetsOptions : Instantiate ListClusterNetworkSubnetsOptions
func (*VpcV1) NewListClusterNetworkSubnetsOptions(clusterNetworkID string) *ListClusterNetworkSubnetsOptions {
return &ListClusterNetworkSubnetsOptions{
ClusterNetworkID: core.StringPtr(clusterNetworkID),
}
}
// SetClusterNetworkID : Allow user to set ClusterNetworkID
func (_options *ListClusterNetworkSubnetsOptions) SetClusterNetworkID(clusterNetworkID string) *ListClusterNetworkSubnetsOptions {
_options.ClusterNetworkID = core.StringPtr(clusterNetworkID)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListClusterNetworkSubnetsOptions) SetStart(start string) *ListClusterNetworkSubnetsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListClusterNetworkSubnetsOptions) SetLimit(limit int64) *ListClusterNetworkSubnetsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetName : Allow user to set Name
func (_options *ListClusterNetworkSubnetsOptions) SetName(name string) *ListClusterNetworkSubnetsOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetSort : Allow user to set Sort
func (_options *ListClusterNetworkSubnetsOptions) SetSort(sort string) *ListClusterNetworkSubnetsOptions {
_options.Sort = core.StringPtr(sort)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListClusterNetworkSubnetsOptions) SetHeaders(param map[string]string) *ListClusterNetworkSubnetsOptions {
options.Headers = param
return options
}
// ListClusterNetworksOptions : The ListClusterNetworks options.
type ListClusterNetworksOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
Sort *string `json:"sort,omitempty"`
// Filters the collection to cluster networks with a `vpc.id` property matching the specified id.
VPCID *string `json:"vpc.id,omitempty"`
// Filters the collection to cluster networks with a `vpc.crn` property matching the specified CRN.
VPCCRN *string `json:"vpc.crn,omitempty"`
// Filters the collection to cluster networks with a `vpc.name` property matching the specified name.
VPCName *string `json:"vpc.name,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListClusterNetworksOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
const (
ListClusterNetworksOptionsSortCreatedAtConst = "created_at"
ListClusterNetworksOptionsSortNameConst = "name"
)
// NewListClusterNetworksOptions : Instantiate ListClusterNetworksOptions
func (*VpcV1) NewListClusterNetworksOptions() *ListClusterNetworksOptions {
return &ListClusterNetworksOptions{}
}
// SetStart : Allow user to set Start
func (_options *ListClusterNetworksOptions) SetStart(start string) *ListClusterNetworksOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListClusterNetworksOptions) SetLimit(limit int64) *ListClusterNetworksOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetResourceGroupID : Allow user to set ResourceGroupID
func (_options *ListClusterNetworksOptions) SetResourceGroupID(resourceGroupID string) *ListClusterNetworksOptions {
_options.ResourceGroupID = core.StringPtr(resourceGroupID)
return _options
}
// SetName : Allow user to set Name
func (_options *ListClusterNetworksOptions) SetName(name string) *ListClusterNetworksOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetSort : Allow user to set Sort
func (_options *ListClusterNetworksOptions) SetSort(sort string) *ListClusterNetworksOptions {
_options.Sort = core.StringPtr(sort)
return _options
}
// SetVPCID : Allow user to set VPCID
func (_options *ListClusterNetworksOptions) SetVPCID(vpcID string) *ListClusterNetworksOptions {
_options.VPCID = core.StringPtr(vpcID)
return _options
}
// SetVPCCRN : Allow user to set VPCCRN
func (_options *ListClusterNetworksOptions) SetVPCCRN(vpcCRN string) *ListClusterNetworksOptions {
_options.VPCCRN = core.StringPtr(vpcCRN)
return _options
}
// SetVPCName : Allow user to set VPCName
func (_options *ListClusterNetworksOptions) SetVPCName(vpcName string) *ListClusterNetworksOptions {
_options.VPCName = core.StringPtr(vpcName)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListClusterNetworksOptions) SetHeaders(param map[string]string) *ListClusterNetworksOptions {
options.Headers = param
return options
}
// ListDedicatedHostDisksOptions : The ListDedicatedHostDisks options.
type ListDedicatedHostDisksOptions struct {
// The dedicated host identifier.
DedicatedHostID *string `json:"dedicated_host_id" 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-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Filters the collection to resources with a `zone.name` property matching the exact specified name.
ZoneName *string `json:"zone.name,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// 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
}
// SetName : Allow user to set Name
func (_options *ListDedicatedHostGroupsOptions) SetName(name string) *ListDedicatedHostGroupsOptions {
_options.Name = core.StringPtr(name)
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-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// 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 hosts with a `group.id` property matching the specified identifier.
DedicatedHostGroupID *string `json:"dedicated_host_group.id,omitempty"`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Filters the collection to resources with a `zone.name` property matching the exact specified name.
ZoneName *string `json:"zone.name,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// 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
}
// SetName : Allow user to set Name
func (_options *ListDedicatedHostsOptions) SetName(name string) *ListDedicatedHostsOptions {
_options.Name = core.StringPtr(name)
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 `json:"endpoint_gateway_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
Sort *string `json:"sort,omitempty"`
// 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 property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property 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 a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Filters the collection to resources with a `lifecycle_state` property matching one of the specified comma-separated
// values.
LifecycleState []string `json:"lifecycle_state,omitempty"`
// Filters the collection to resources with a `vpc.id` property matching the specified identifier.
VPCID *string `json:"vpc.id,omitempty"`
// Filters the collection to resources with a `vpc.crn` property matching the specified CRN.
VPCCRN *string `json:"vpc.crn,omitempty"`
// Filters the collection to resources with a `vpc.name` property matching the exact specified name.
VPCName *string `json:"vpc.name,omitempty"`
// Filters the collection to endpoint gateways with an `allow_dns_resolution_binding` property matching the specified
// value.
AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListEndpointGatewaysOptions.LifecycleState property.
const (
ListEndpointGatewaysOptionsLifecycleStateDeletingConst = "deleting"
ListEndpointGatewaysOptionsLifecycleStateFailedConst = "failed"
ListEndpointGatewaysOptionsLifecycleStatePendingConst = "pending"
ListEndpointGatewaysOptionsLifecycleStateStableConst = "stable"
ListEndpointGatewaysOptionsLifecycleStateSuspendedConst = "suspended"
ListEndpointGatewaysOptionsLifecycleStateUpdatingConst = "updating"
ListEndpointGatewaysOptionsLifecycleStateWaitingConst = "waiting"
)
// 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
}
// SetLifecycleState : Allow user to set LifecycleState
func (_options *ListEndpointGatewaysOptions) SetLifecycleState(lifecycleState []string) *ListEndpointGatewaysOptions {
_options.LifecycleState = lifecycleState
return _options
}
// SetVPCID : Allow user to set VPCID
func (_options *ListEndpointGatewaysOptions) SetVPCID(vpcID string) *ListEndpointGatewaysOptions {
_options.VPCID = core.StringPtr(vpcID)
return _options
}
// SetVPCCRN : Allow user to set VPCCRN
func (_options *ListEndpointGatewaysOptions) SetVPCCRN(vpcCRN string) *ListEndpointGatewaysOptions {
_options.VPCCRN = core.StringPtr(vpcCRN)
return _options
}
// SetVPCName : Allow user to set VPCName
func (_options *ListEndpointGatewaysOptions) SetVPCName(vpcName string) *ListEndpointGatewaysOptions {
_options.VPCName = core.StringPtr(vpcName)
return _options
}
// SetAllowDnsResolutionBinding : Allow user to set AllowDnsResolutionBinding
func (_options *ListEndpointGatewaysOptions) SetAllowDnsResolutionBinding(allowDnsResolutionBinding bool) *ListEndpointGatewaysOptions {
_options.AllowDnsResolutionBinding = core.BoolPtr(allowDnsResolutionBinding)
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-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
Sort *string `json:"sort,omitempty"`
// Filters the collection to resources with a `target.id` property matching the specified identifier.
TargetID *string `json:"target.id,omitempty"`
// Filters the collection to resources with a `target.crn` property matching the specified CRN.
TargetCRN *string `json:"target.crn,omitempty"`
// Filters the collection to resources with a `target.name` property matching the exact specified name.
TargetName *string `json:"target.name,omitempty"`
// Filters the collection to resources with a `target.resource_type` property matching the specified value.
TargetResourceType *string `json:"target.resource_type,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListFloatingIpsOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
const (
ListFloatingIpsOptionsSortCreatedAtConst = "created_at"
ListFloatingIpsOptionsSortNameConst = "name"
)
// 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
}
// SetSort : Allow user to set Sort
func (_options *ListFloatingIpsOptions) SetSort(sort string) *ListFloatingIpsOptions {
_options.Sort = core.StringPtr(sort)
return _options
}
// SetTargetID : Allow user to set TargetID
func (_options *ListFloatingIpsOptions) SetTargetID(targetID string) *ListFloatingIpsOptions {
_options.TargetID = core.StringPtr(targetID)
return _options
}
// SetTargetCRN : Allow user to set TargetCRN
func (_options *ListFloatingIpsOptions) SetTargetCRN(targetCRN string) *ListFloatingIpsOptions {
_options.TargetCRN = core.StringPtr(targetCRN)
return _options
}
// SetTargetName : Allow user to set TargetName
func (_options *ListFloatingIpsOptions) SetTargetName(targetName string) *ListFloatingIpsOptions {
_options.TargetName = core.StringPtr(targetName)
return _options
}
// SetTargetResourceType : Allow user to set TargetResourceType
func (_options *ListFloatingIpsOptions) SetTargetResourceType(targetResourceType string) *ListFloatingIpsOptions {
_options.TargetResourceType = core.StringPtr(targetResourceType)
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-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// Filters the collection to resources with a `vpc.id` property matching the specified identifier.
VPCID *string `json:"vpc.id,omitempty"`
// Filters the collection to resources with a `vpc.crn` property matching the specified CRN.
VPCCRN *string `json:"vpc.crn,omitempty"`
// Filters the collection to resources with a `vpc.name` property matching the exact specified name.
VPCName *string `json:"vpc.name,omitempty"`
// Filters the collection to resources with a `target.id` property matching the specified identifier.
TargetID *string `json:"target.id,omitempty"`
// Filters the collection to resources with a `target.resource_type` property matching the specified value.
TargetResourceType *string `json:"target.resource_type,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// 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-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// 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 `json:"id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// 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
}
// SetStart : Allow user to set Start
func (_options *ListIkePolicyConnectionsOptions) SetStart(start string) *ListIkePolicyConnectionsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListIkePolicyConnectionsOptions) SetLimit(limit int64) *ListIkePolicyConnectionsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListIkePolicyConnectionsOptions) SetHeaders(param map[string]string) *ListIkePolicyConnectionsOptions {
options.Headers = param
return options
}
// ListImageBareMetalServerProfilesOptions : The ListImageBareMetalServerProfiles options.
type ListImageBareMetalServerProfilesOptions struct {
// The image identifier.
ID *string `json:"id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListImageBareMetalServerProfilesOptions : Instantiate ListImageBareMetalServerProfilesOptions
func (*VpcV1) NewListImageBareMetalServerProfilesOptions(id string) *ListImageBareMetalServerProfilesOptions {
return &ListImageBareMetalServerProfilesOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *ListImageBareMetalServerProfilesOptions) SetID(id string) *ListImageBareMetalServerProfilesOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListImageBareMetalServerProfilesOptions) SetStart(start string) *ListImageBareMetalServerProfilesOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListImageBareMetalServerProfilesOptions) SetLimit(limit int64) *ListImageBareMetalServerProfilesOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListImageBareMetalServerProfilesOptions) SetHeaders(param map[string]string) *ListImageBareMetalServerProfilesOptions {
options.Headers = param
return options
}
// ListImageExportJobsOptions : The ListImageExportJobs options.
type ListImageExportJobsOptions struct {
// The image identifier.
ImageID *string `json:"image_id" validate:"required,ne="`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListImageExportJobsOptions : Instantiate ListImageExportJobsOptions
func (*VpcV1) NewListImageExportJobsOptions(imageID string) *ListImageExportJobsOptions {
return &ListImageExportJobsOptions{
ImageID: core.StringPtr(imageID),
}
}
// SetImageID : Allow user to set ImageID
func (_options *ListImageExportJobsOptions) SetImageID(imageID string) *ListImageExportJobsOptions {
_options.ImageID = core.StringPtr(imageID)
return _options
}
// SetName : Allow user to set Name
func (_options *ListImageExportJobsOptions) SetName(name string) *ListImageExportJobsOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListImageExportJobsOptions) SetHeaders(param map[string]string) *ListImageExportJobsOptions {
options.Headers = param
return options
}
// ListImageInstanceProfilesOptions : The ListImageInstanceProfiles options.
type ListImageInstanceProfilesOptions struct {
// The image identifier.
ID *string `json:"id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListImageInstanceProfilesOptions : Instantiate ListImageInstanceProfilesOptions
func (*VpcV1) NewListImageInstanceProfilesOptions(id string) *ListImageInstanceProfilesOptions {
return &ListImageInstanceProfilesOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *ListImageInstanceProfilesOptions) SetID(id string) *ListImageInstanceProfilesOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListImageInstanceProfilesOptions) SetStart(start string) *ListImageInstanceProfilesOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListImageInstanceProfilesOptions) SetLimit(limit int64) *ListImageInstanceProfilesOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListImageInstanceProfilesOptions) SetHeaders(param map[string]string) *ListImageInstanceProfilesOptions {
options.Headers = param
return options
}
// ListImagesOptions : The ListImages options.
type ListImagesOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// Filters the collection to images with a `status` property matching one of the specified comma-separated values.
Status []string `json:"status,omitempty"`
// 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"`
// Filters the collection to images with a `remote.account.id` property matching the specified account identifier.
//
// This parameter also supports the values null and not:null which filter the collection to resources which have no
// remote account identifier or any remote account identifier, respectively.
RemoteAccountID *string `json:"remote.account.id,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListImagesOptions.Status property.
const (
ListImagesOptionsStatusAvailableConst = "available"
ListImagesOptionsStatusDeletingConst = "deleting"
ListImagesOptionsStatusDeprecatedConst = "deprecated"
ListImagesOptionsStatusFailedConst = "failed"
ListImagesOptionsStatusObsoleteConst = "obsolete"
ListImagesOptionsStatusPendingConst = "pending"
ListImagesOptionsStatusUnusableConst = "unusable"
)
// Constants associated with the ListImagesOptions.Visibility property.
// Filters the collection to images with a `visibility` property matching the specified value.
const (
ListImagesOptionsVisibilityPrivateConst = "private"
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{}
}
// 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
}
// SetStatus : Allow user to set Status
func (_options *ListImagesOptions) SetStatus(status []string) *ListImagesOptions {
_options.Status = status
return _options
}
// SetVisibility : Allow user to set Visibility
func (_options *ListImagesOptions) SetVisibility(visibility string) *ListImagesOptions {
_options.Visibility = core.StringPtr(visibility)
return _options
}
// SetUserDataFormat : Allow user to set UserDataFormat
func (_options *ListImagesOptions) SetUserDataFormat(userDataFormat []string) *ListImagesOptions {
_options.UserDataFormat = userDataFormat
return _options
}
// SetRemoteAccountID : Allow user to set RemoteAccountID
func (_options *ListImagesOptions) SetRemoteAccountID(remoteAccountID string) *ListImagesOptions {
_options.RemoteAccountID = core.StringPtr(remoteAccountID)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListImagesOptions) SetHeaders(param map[string]string) *ListImagesOptions {
options.Headers = param
return options
}
// ListInstanceClusterNetworkAttachmentsOptions : The ListInstanceClusterNetworkAttachments options.
type ListInstanceClusterNetworkAttachmentsOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListInstanceClusterNetworkAttachmentsOptions : Instantiate ListInstanceClusterNetworkAttachmentsOptions
func (*VpcV1) NewListInstanceClusterNetworkAttachmentsOptions(instanceID string) *ListInstanceClusterNetworkAttachmentsOptions {
return &ListInstanceClusterNetworkAttachmentsOptions{
InstanceID: core.StringPtr(instanceID),
}
}
// SetInstanceID : Allow user to set InstanceID
func (_options *ListInstanceClusterNetworkAttachmentsOptions) SetInstanceID(instanceID string) *ListInstanceClusterNetworkAttachmentsOptions {
_options.InstanceID = core.StringPtr(instanceID)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListInstanceClusterNetworkAttachmentsOptions) SetStart(start string) *ListInstanceClusterNetworkAttachmentsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListInstanceClusterNetworkAttachmentsOptions) SetLimit(limit int64) *ListInstanceClusterNetworkAttachmentsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListInstanceClusterNetworkAttachmentsOptions) SetHeaders(param map[string]string) *ListInstanceClusterNetworkAttachmentsOptions {
options.Headers = param
return options
}
// ListInstanceDisksOptions : The ListInstanceDisks options.
type ListInstanceDisksOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" 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
}
// ListInstanceGroupManagerActionsOptions : The ListInstanceGroupManagerActions options.
type ListInstanceGroupManagerActionsOptions struct {
// The instance group identifier.
InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="`
// The instance group manager identifier.
InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListInstanceGroupManagerActionsOptions : Instantiate ListInstanceGroupManagerActionsOptions
func (*VpcV1) NewListInstanceGroupManagerActionsOptions(instanceGroupID string, instanceGroupManagerID string) *ListInstanceGroupManagerActionsOptions {
return &ListInstanceGroupManagerActionsOptions{
InstanceGroupID: core.StringPtr(instanceGroupID),
InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID),
}
}
// SetInstanceGroupID : Allow user to set InstanceGroupID
func (_options *ListInstanceGroupManagerActionsOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagerActionsOptions {
_options.InstanceGroupID = core.StringPtr(instanceGroupID)
return _options
}
// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID
func (_options *ListInstanceGroupManagerActionsOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *ListInstanceGroupManagerActionsOptions {
_options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListInstanceGroupManagerActionsOptions) SetStart(start string) *ListInstanceGroupManagerActionsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListInstanceGroupManagerActionsOptions) SetLimit(limit int64) *ListInstanceGroupManagerActionsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListInstanceGroupManagerActionsOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagerActionsOptions {
options.Headers = param
return options
}
// ListInstanceGroupManagerPoliciesOptions : The ListInstanceGroupManagerPolicies options.
type ListInstanceGroupManagerPoliciesOptions struct {
// The instance group identifier.
InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="`
// The instance group manager identifier.
InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// 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 `json:"instance_group_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// 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 `json:"instance_group_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// 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-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// 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
}
// ListInstanceNetworkAttachmentsOptions : The ListInstanceNetworkAttachments options.
type ListInstanceNetworkAttachmentsOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListInstanceNetworkAttachmentsOptions : Instantiate ListInstanceNetworkAttachmentsOptions
func (*VpcV1) NewListInstanceNetworkAttachmentsOptions(instanceID string) *ListInstanceNetworkAttachmentsOptions {
return &ListInstanceNetworkAttachmentsOptions{
InstanceID: core.StringPtr(instanceID),
}
}
// SetInstanceID : Allow user to set InstanceID
func (_options *ListInstanceNetworkAttachmentsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkAttachmentsOptions {
_options.InstanceID = core.StringPtr(instanceID)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListInstanceNetworkAttachmentsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkAttachmentsOptions {
options.Headers = param
return options
}
// ListInstanceNetworkInterfaceFloatingIpsOptions : The ListInstanceNetworkInterfaceFloatingIps options.
type ListInstanceNetworkInterfaceFloatingIpsOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance network interface identifier.
NetworkInterfaceID *string `json:"network_interface_id" 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
}
// ListInstanceNetworkInterfaceIpsOptions : The ListInstanceNetworkInterfaceIps options.
type ListInstanceNetworkInterfaceIpsOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance network interface identifier.
NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListInstanceNetworkInterfaceIpsOptions : Instantiate ListInstanceNetworkInterfaceIpsOptions
func (*VpcV1) NewListInstanceNetworkInterfaceIpsOptions(instanceID string, networkInterfaceID string) *ListInstanceNetworkInterfaceIpsOptions {
return &ListInstanceNetworkInterfaceIpsOptions{
InstanceID: core.StringPtr(instanceID),
NetworkInterfaceID: core.StringPtr(networkInterfaceID),
}
}
// SetInstanceID : Allow user to set InstanceID
func (_options *ListInstanceNetworkInterfaceIpsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkInterfaceIpsOptions {
_options.InstanceID = core.StringPtr(instanceID)
return _options
}
// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID
func (_options *ListInstanceNetworkInterfaceIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListInstanceNetworkInterfaceIpsOptions {
_options.NetworkInterfaceID = core.StringPtr(networkInterfaceID)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListInstanceNetworkInterfaceIpsOptions) SetStart(start string) *ListInstanceNetworkInterfaceIpsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListInstanceNetworkInterfaceIpsOptions) SetLimit(limit int64) *ListInstanceNetworkInterfaceIpsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListInstanceNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkInterfaceIpsOptions {
options.Headers = param
return options
}
// ListInstanceNetworkInterfacesOptions : The ListInstanceNetworkInterfaces options.
type ListInstanceNetworkInterfacesOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" 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 virtual server instance identifier.
InstanceID *string `json:"instance_id" 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-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// Filters the collection to instances with a `cluster_network.id` property matching the specified identifier.
ClusterNetworkID *string `json:"cluster_network.id,omitempty"`
// Filters the collection to instances with a `cluster_network.crn` property matching the specified CRN.
ClusterNetworkCRN *string `json:"cluster_network.crn,omitempty"`
// Filters the collection to resources with a `cluster_network.name` property matching the exact specified name.
ClusterNetworkName *string `json:"cluster_network.name,omitempty"`
// Filters the collection to resources with a `dedicated_host.id` property matching the specified identifier.
DedicatedHostID *string `json:"dedicated_host.id,omitempty"`
// Filters the collection to resources with a `dedicated_host.crn` property matching the specified CRN.
DedicatedHostCRN *string `json:"dedicated_host.crn,omitempty"`
// Filters the collection to resources with a `dedicated_host.name` property matching the exact specified name.
DedicatedHostName *string `json:"dedicated_host.name,omitempty"`
// Filters the collection to resources with a `placement_target.id` property matching the specified placement group
// identifier.
PlacementGroupID *string `json:"placement_group.id,omitempty"`
// Filters the collection to resources with a `placement_target.crn` property matching the specified placement group
// CRN.
PlacementGroupCRN *string `json:"placement_group.crn,omitempty"`
// Filters the collection to resources with a `placement_target.name` property matching the exact specified placement
// group name.
PlacementGroupName *string `json:"placement_group.name,omitempty"`
// Filters the collection to instances with a `reservation_affinity.policy` property matching the specified value.
ReservationAffinityPolicy *string `json:"reservation_affinity.policy,omitempty"`
// Filters the collection to resources with a `reservation.id` property matching the specified identifier.
ReservationID *string `json:"reservation.id,omitempty"`
// Filters the collection to resources with a `reservation.crn` property matching the specified identifier.
ReservationCRN *string `json:"reservation.crn,omitempty"`
// Filters the collection to resources with a `reservation.name` property matching the specified identifier.
ReservationName *string `json:"reservation.name,omitempty"`
// Filters the collection to resources with a `vpc.id` property matching the specified identifier.
VPCID *string `json:"vpc.id,omitempty"`
// Filters the collection to resources with a `vpc.crn` property matching the specified CRN.
VPCCRN *string `json:"vpc.crn,omitempty"`
// Filters the collection to resources with a `vpc.name` property matching the exact specified name.
VPCName *string `json:"vpc.name,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListInstancesOptions.ReservationAffinityPolicy property.
// Filters the collection to instances with a `reservation_affinity.policy` property matching the specified value.
const (
ListInstancesOptionsReservationAffinityPolicyAutomaticConst = "automatic"
ListInstancesOptionsReservationAffinityPolicyDisabledConst = "disabled"
ListInstancesOptionsReservationAffinityPolicyManualConst = "manual"
)
// 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
}
// SetClusterNetworkID : Allow user to set ClusterNetworkID
func (_options *ListInstancesOptions) SetClusterNetworkID(clusterNetworkID string) *ListInstancesOptions {
_options.ClusterNetworkID = core.StringPtr(clusterNetworkID)
return _options
}
// SetClusterNetworkCRN : Allow user to set ClusterNetworkCRN
func (_options *ListInstancesOptions) SetClusterNetworkCRN(clusterNetworkCRN string) *ListInstancesOptions {
_options.ClusterNetworkCRN = core.StringPtr(clusterNetworkCRN)
return _options
}
// SetClusterNetworkName : Allow user to set ClusterNetworkName
func (_options *ListInstancesOptions) SetClusterNetworkName(clusterNetworkName string) *ListInstancesOptions {
_options.ClusterNetworkName = core.StringPtr(clusterNetworkName)
return _options
}
// SetDedicatedHostID : Allow user to set DedicatedHostID
func (_options *ListInstancesOptions) SetDedicatedHostID(dedicatedHostID string) *ListInstancesOptions {
_options.DedicatedHostID = core.StringPtr(dedicatedHostID)
return _options
}
// SetDedicatedHostCRN : Allow user to set DedicatedHostCRN
func (_options *ListInstancesOptions) SetDedicatedHostCRN(dedicatedHostCRN string) *ListInstancesOptions {
_options.DedicatedHostCRN = core.StringPtr(dedicatedHostCRN)
return _options
}
// SetDedicatedHostName : Allow user to set DedicatedHostName
func (_options *ListInstancesOptions) SetDedicatedHostName(dedicatedHostName string) *ListInstancesOptions {
_options.DedicatedHostName = core.StringPtr(dedicatedHostName)
return _options
}
// SetPlacementGroupID : Allow user to set PlacementGroupID
func (_options *ListInstancesOptions) SetPlacementGroupID(placementGroupID string) *ListInstancesOptions {
_options.PlacementGroupID = core.StringPtr(placementGroupID)
return _options
}
// SetPlacementGroupCRN : Allow user to set PlacementGroupCRN
func (_options *ListInstancesOptions) SetPlacementGroupCRN(placementGroupCRN string) *ListInstancesOptions {
_options.PlacementGroupCRN = core.StringPtr(placementGroupCRN)
return _options
}
// SetPlacementGroupName : Allow user to set PlacementGroupName
func (_options *ListInstancesOptions) SetPlacementGroupName(placementGroupName string) *ListInstancesOptions {
_options.PlacementGroupName = core.StringPtr(placementGroupName)
return _options
}
// SetReservationAffinityPolicy : Allow user to set ReservationAffinityPolicy
func (_options *ListInstancesOptions) SetReservationAffinityPolicy(reservationAffinityPolicy string) *ListInstancesOptions {
_options.ReservationAffinityPolicy = core.StringPtr(reservationAffinityPolicy)
return _options
}
// SetReservationID : Allow user to set ReservationID
func (_options *ListInstancesOptions) SetReservationID(reservationID string) *ListInstancesOptions {
_options.ReservationID = core.StringPtr(reservationID)
return _options
}
// SetReservationCRN : Allow user to set ReservationCRN
func (_options *ListInstancesOptions) SetReservationCRN(reservationCRN string) *ListInstancesOptions {
_options.ReservationCRN = core.StringPtr(reservationCRN)
return _options
}
// SetReservationName : Allow user to set ReservationName
func (_options *ListInstancesOptions) SetReservationName(reservationName string) *ListInstancesOptions {
_options.ReservationName = core.StringPtr(reservationName)
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-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// 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 `json:"id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// 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
}
// SetStart : Allow user to set Start
func (_options *ListIpsecPolicyConnectionsOptions) SetStart(start string) *ListIpsecPolicyConnectionsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListIpsecPolicyConnectionsOptions) SetLimit(limit int64) *ListIpsecPolicyConnectionsOptions {
_options.Limit = core.Int64Ptr(limit)
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 {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListKeysOptions : Instantiate ListKeysOptions
func (*VpcV1) NewListKeysOptions() *ListKeysOptions {
return &ListKeysOptions{}
}
// SetStart : Allow user to set Start
func (_options *ListKeysOptions) SetStart(start string) *ListKeysOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListKeysOptions) SetLimit(limit int64) *ListKeysOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// 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 `json:"load_balancer_id" validate:"required,ne="`
// The listener identifier.
ListenerID *string `json:"listener_id" 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 `json:"load_balancer_id" validate:"required,ne="`
// The listener identifier.
ListenerID *string `json:"listener_id" validate:"required,ne="`
// The policy identifier.
PolicyID *string `json:"policy_id" 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 `json:"load_balancer_id" 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 `json:"load_balancer_id" validate:"required,ne="`
// The pool identifier.
PoolID *string `json:"pool_id" 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 `json:"load_balancer_id" 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-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// 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 {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListLoadBalancersOptions : Instantiate ListLoadBalancersOptions
func (*VpcV1) NewListLoadBalancersOptions() *ListLoadBalancersOptions {
return &ListLoadBalancersOptions{}
}
// SetStart : Allow user to set Start
func (_options *ListLoadBalancersOptions) SetStart(start string) *ListLoadBalancersOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListLoadBalancersOptions) SetLimit(limit int64) *ListLoadBalancersOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// 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 `json:"network_acl_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to rules with a `direction` property matching the specified value.
Direction *string `json:"direction,omitempty"`
// 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 a `direction` property matching the specified value.
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-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// 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
}
// ListNetworkInterfaceFloatingIpsOptions : The ListNetworkInterfaceFloatingIps options.
type ListNetworkInterfaceFloatingIpsOptions struct {
// The virtual network interface identifier.
VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value
// `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name`
// property in ascending order.
Sort *string `json:"sort,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListNetworkInterfaceFloatingIpsOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value
// `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name`
// property in ascending order.
const (
ListNetworkInterfaceFloatingIpsOptionsSortAddressConst = "address"
ListNetworkInterfaceFloatingIpsOptionsSortNameConst = "name"
)
// NewListNetworkInterfaceFloatingIpsOptions : Instantiate ListNetworkInterfaceFloatingIpsOptions
func (*VpcV1) NewListNetworkInterfaceFloatingIpsOptions(virtualNetworkInterfaceID string) *ListNetworkInterfaceFloatingIpsOptions {
return &ListNetworkInterfaceFloatingIpsOptions{
VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID),
}
}
// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID
func (_options *ListNetworkInterfaceFloatingIpsOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *ListNetworkInterfaceFloatingIpsOptions {
_options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListNetworkInterfaceFloatingIpsOptions) SetStart(start string) *ListNetworkInterfaceFloatingIpsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListNetworkInterfaceFloatingIpsOptions) SetLimit(limit int64) *ListNetworkInterfaceFloatingIpsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetSort : Allow user to set Sort
func (_options *ListNetworkInterfaceFloatingIpsOptions) SetSort(sort string) *ListNetworkInterfaceFloatingIpsOptions {
_options.Sort = core.StringPtr(sort)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListNetworkInterfaceFloatingIpsOptions) SetHeaders(param map[string]string) *ListNetworkInterfaceFloatingIpsOptions {
options.Headers = param
return options
}
// ListOperatingSystemsOptions : The ListOperatingSystems options.
type ListOperatingSystemsOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// 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
}
// ListPlacementGroupsOptions : The ListPlacementGroups options.
type ListPlacementGroupsOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListPlacementGroupsOptions : Instantiate ListPlacementGroupsOptions
func (*VpcV1) NewListPlacementGroupsOptions() *ListPlacementGroupsOptions {
return &ListPlacementGroupsOptions{}
}
// SetStart : Allow user to set Start
func (_options *ListPlacementGroupsOptions) SetStart(start string) *ListPlacementGroupsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListPlacementGroupsOptions) SetLimit(limit int64) *ListPlacementGroupsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListPlacementGroupsOptions) SetHeaders(param map[string]string) *ListPlacementGroupsOptions {
options.Headers = param
return options
}
// ListPrivatePathServiceGatewayAccountPoliciesOptions : The ListPrivatePathServiceGatewayAccountPolicies options.
type ListPrivatePathServiceGatewayAccountPoliciesOptions struct {
// The private path service gateway identifier.
PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with an `account.id` property matching the specified identifier.
AccountID *string `json:"account.id,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListPrivatePathServiceGatewayAccountPoliciesOptions : Instantiate ListPrivatePathServiceGatewayAccountPoliciesOptions
func (*VpcV1) NewListPrivatePathServiceGatewayAccountPoliciesOptions(privatePathServiceGatewayID string) *ListPrivatePathServiceGatewayAccountPoliciesOptions {
return &ListPrivatePathServiceGatewayAccountPoliciesOptions{
PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID),
}
}
// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID
func (_options *ListPrivatePathServiceGatewayAccountPoliciesOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *ListPrivatePathServiceGatewayAccountPoliciesOptions {
_options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListPrivatePathServiceGatewayAccountPoliciesOptions) SetStart(start string) *ListPrivatePathServiceGatewayAccountPoliciesOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListPrivatePathServiceGatewayAccountPoliciesOptions) SetLimit(limit int64) *ListPrivatePathServiceGatewayAccountPoliciesOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetAccountID : Allow user to set AccountID
func (_options *ListPrivatePathServiceGatewayAccountPoliciesOptions) SetAccountID(accountID string) *ListPrivatePathServiceGatewayAccountPoliciesOptions {
_options.AccountID = core.StringPtr(accountID)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListPrivatePathServiceGatewayAccountPoliciesOptions) SetHeaders(param map[string]string) *ListPrivatePathServiceGatewayAccountPoliciesOptions {
options.Headers = param
return options
}
// ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions : The ListPrivatePathServiceGatewayEndpointGatewayBindings options.
type ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions struct {
// The private path service gateway identifier.
PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to endpoint gateway bindings with a `status` property matching the specified value.
Status *string `json:"status,omitempty"`
// Filters the collection to resources with an `account.id` property matching the specified identifier.
AccountID *string `json:"account.id,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Status property.
// Filters the collection to endpoint gateway bindings with a `status` property matching the specified value.
const (
ListPrivatePathServiceGatewayEndpointGatewayBindingsOptionsStatusAbandonedConst = "abandoned"
ListPrivatePathServiceGatewayEndpointGatewayBindingsOptionsStatusDeniedConst = "denied"
ListPrivatePathServiceGatewayEndpointGatewayBindingsOptionsStatusExpiredConst = "expired"
ListPrivatePathServiceGatewayEndpointGatewayBindingsOptionsStatusPendingConst = "pending"
ListPrivatePathServiceGatewayEndpointGatewayBindingsOptionsStatusPermittedConst = "permitted"
)
// NewListPrivatePathServiceGatewayEndpointGatewayBindingsOptions : Instantiate ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions
func (*VpcV1) NewListPrivatePathServiceGatewayEndpointGatewayBindingsOptions(privatePathServiceGatewayID string) *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions {
return &ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions{
PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID),
}
}
// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID
func (_options *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions {
_options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) SetStart(start string) *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) SetLimit(limit int64) *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetStatus : Allow user to set Status
func (_options *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) SetStatus(status string) *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions {
_options.Status = core.StringPtr(status)
return _options
}
// SetAccountID : Allow user to set AccountID
func (_options *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) SetAccountID(accountID string) *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions {
_options.AccountID = core.StringPtr(accountID)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) SetHeaders(param map[string]string) *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions {
options.Headers = param
return options
}
// ListPrivatePathServiceGatewaysOptions : The ListPrivatePathServiceGateways options.
type ListPrivatePathServiceGatewaysOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListPrivatePathServiceGatewaysOptions : Instantiate ListPrivatePathServiceGatewaysOptions
func (*VpcV1) NewListPrivatePathServiceGatewaysOptions() *ListPrivatePathServiceGatewaysOptions {
return &ListPrivatePathServiceGatewaysOptions{}
}
// SetStart : Allow user to set Start
func (_options *ListPrivatePathServiceGatewaysOptions) SetStart(start string) *ListPrivatePathServiceGatewaysOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListPrivatePathServiceGatewaysOptions) SetLimit(limit int64) *ListPrivatePathServiceGatewaysOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetResourceGroupID : Allow user to set ResourceGroupID
func (_options *ListPrivatePathServiceGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListPrivatePathServiceGatewaysOptions {
_options.ResourceGroupID = core.StringPtr(resourceGroupID)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListPrivatePathServiceGatewaysOptions) SetHeaders(param map[string]string) *ListPrivatePathServiceGatewaysOptions {
options.Headers = param
return options
}
// ListPublicAddressRangesOptions : The ListPublicAddressRanges options.
type ListPublicAddressRangesOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListPublicAddressRangesOptions : Instantiate ListPublicAddressRangesOptions
func (*VpcV1) NewListPublicAddressRangesOptions() *ListPublicAddressRangesOptions {
return &ListPublicAddressRangesOptions{}
}
// SetStart : Allow user to set Start
func (_options *ListPublicAddressRangesOptions) SetStart(start string) *ListPublicAddressRangesOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListPublicAddressRangesOptions) SetLimit(limit int64) *ListPublicAddressRangesOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetResourceGroupID : Allow user to set ResourceGroupID
func (_options *ListPublicAddressRangesOptions) SetResourceGroupID(resourceGroupID string) *ListPublicAddressRangesOptions {
_options.ResourceGroupID = core.StringPtr(resourceGroupID)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListPublicAddressRangesOptions) SetHeaders(param map[string]string) *ListPublicAddressRangesOptions {
options.Headers = param
return options
}
// ListPublicGatewaysOptions : The ListPublicGateways options.
type ListPublicGatewaysOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// 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 `json:"region_name" 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
}
// ListReservationsOptions : The ListReservations options.
type ListReservationsOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// Filters the collection of resources with a `profile.resource_type` property matching the specified value.
ProfileResourceType *string `json:"profile.resource_type,omitempty"`
// Filters the collection to reservations with an `affinity_policy` property matching the specified value.
AffinityPolicy *string `json:"affinity_policy,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Filters the collection to resources with a `zone.name` property matching the exact specified name.
ZoneName *string `json:"zone.name,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListReservationsOptions.AffinityPolicy property.
// Filters the collection to reservations with an `affinity_policy` property matching the specified value.
const (
ListReservationsOptionsAffinityPolicyAutomaticConst = "automatic"
ListReservationsOptionsAffinityPolicyRestrictedConst = "restricted"
)
// NewListReservationsOptions : Instantiate ListReservationsOptions
func (*VpcV1) NewListReservationsOptions() *ListReservationsOptions {
return &ListReservationsOptions{}
}
// SetStart : Allow user to set Start
func (_options *ListReservationsOptions) SetStart(start string) *ListReservationsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListReservationsOptions) SetLimit(limit int64) *ListReservationsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetName : Allow user to set Name
func (_options *ListReservationsOptions) SetName(name string) *ListReservationsOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetProfileResourceType : Allow user to set ProfileResourceType
func (_options *ListReservationsOptions) SetProfileResourceType(profileResourceType string) *ListReservationsOptions {
_options.ProfileResourceType = core.StringPtr(profileResourceType)
return _options
}
// SetAffinityPolicy : Allow user to set AffinityPolicy
func (_options *ListReservationsOptions) SetAffinityPolicy(affinityPolicy string) *ListReservationsOptions {
_options.AffinityPolicy = core.StringPtr(affinityPolicy)
return _options
}
// SetResourceGroupID : Allow user to set ResourceGroupID
func (_options *ListReservationsOptions) SetResourceGroupID(resourceGroupID string) *ListReservationsOptions {
_options.ResourceGroupID = core.StringPtr(resourceGroupID)
return _options
}
// SetZoneName : Allow user to set ZoneName
func (_options *ListReservationsOptions) SetZoneName(zoneName string) *ListReservationsOptions {
_options.ZoneName = core.StringPtr(zoneName)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListReservationsOptions) SetHeaders(param map[string]string) *ListReservationsOptions {
options.Headers = param
return options
}
// ListSecurityGroupRulesOptions : The ListSecurityGroupRules options.
type ListSecurityGroupRulesOptions struct {
// The security group identifier.
SecurityGroupID *string `json:"security_group_id" 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 `json:"security_group_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// 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-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Filters the collection to resources with a `vpc.id` property matching the specified identifier.
VPCID *string `json:"vpc.id,omitempty"`
// Filters the collection to resources with a `vpc.crn` property matching the specified CRN.
VPCCRN *string `json:"vpc.crn,omitempty"`
// Filters the collection to resources with a `vpc.name` property matching the exact specified name.
VPCName *string `json:"vpc.name,omitempty"`
// 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
}
// ListShareAccessorBindingsOptions : The ListShareAccessorBindings options.
type ListShareAccessorBindingsOptions struct {
// The file share identifier.
ID *string `json:"id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListShareAccessorBindingsOptions : Instantiate ListShareAccessorBindingsOptions
func (*VpcV1) NewListShareAccessorBindingsOptions(id string) *ListShareAccessorBindingsOptions {
return &ListShareAccessorBindingsOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *ListShareAccessorBindingsOptions) SetID(id string) *ListShareAccessorBindingsOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListShareAccessorBindingsOptions) SetStart(start string) *ListShareAccessorBindingsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListShareAccessorBindingsOptions) SetLimit(limit int64) *ListShareAccessorBindingsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListShareAccessorBindingsOptions) SetHeaders(param map[string]string) *ListShareAccessorBindingsOptions {
options.Headers = param
return options
}
// ListShareMountTargetsOptions : The ListShareMountTargets options.
type ListShareMountTargetsOptions struct {
// The file share identifier.
ShareID *string `json:"share_id" validate:"required,ne="`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListShareMountTargetsOptions : Instantiate ListShareMountTargetsOptions
func (*VpcV1) NewListShareMountTargetsOptions(shareID string) *ListShareMountTargetsOptions {
return &ListShareMountTargetsOptions{
ShareID: core.StringPtr(shareID),
}
}
// SetShareID : Allow user to set ShareID
func (_options *ListShareMountTargetsOptions) SetShareID(shareID string) *ListShareMountTargetsOptions {
_options.ShareID = core.StringPtr(shareID)
return _options
}
// SetName : Allow user to set Name
func (_options *ListShareMountTargetsOptions) SetName(name string) *ListShareMountTargetsOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListShareMountTargetsOptions) SetStart(start string) *ListShareMountTargetsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListShareMountTargetsOptions) SetLimit(limit int64) *ListShareMountTargetsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListShareMountTargetsOptions) SetHeaders(param map[string]string) *ListShareMountTargetsOptions {
options.Headers = param
return options
}
// ListShareProfilesOptions : The ListShareProfiles options.
type ListShareProfilesOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
Sort *string `json:"sort,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListShareProfilesOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
const (
ListShareProfilesOptionsSortCreatedAtConst = "created_at"
ListShareProfilesOptionsSortNameConst = "name"
)
// NewListShareProfilesOptions : Instantiate ListShareProfilesOptions
func (*VpcV1) NewListShareProfilesOptions() *ListShareProfilesOptions {
return &ListShareProfilesOptions{}
}
// SetStart : Allow user to set Start
func (_options *ListShareProfilesOptions) SetStart(start string) *ListShareProfilesOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListShareProfilesOptions) SetLimit(limit int64) *ListShareProfilesOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetSort : Allow user to set Sort
func (_options *ListShareProfilesOptions) SetSort(sort string) *ListShareProfilesOptions {
_options.Sort = core.StringPtr(sort)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListShareProfilesOptions) SetHeaders(param map[string]string) *ListShareProfilesOptions {
options.Headers = param
return options
}
// ListShareSnapshotsOptions : The ListShareSnapshots options.
type ListShareSnapshotsOptions struct {
// The file share identifier, or `-` to wildcard all accessible file shares.
ShareID *string `json:"share_id" validate:"required,ne="`
// Filters the collection to backup policy jobs with a `backup_policy_plan.id` property matching the specified
// identifier.
BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
Sort *string `json:"sort,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListShareSnapshotsOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
const (
ListShareSnapshotsOptionsSortCreatedAtConst = "created_at"
ListShareSnapshotsOptionsSortNameConst = "name"
)
// NewListShareSnapshotsOptions : Instantiate ListShareSnapshotsOptions
func (*VpcV1) NewListShareSnapshotsOptions(shareID string) *ListShareSnapshotsOptions {
return &ListShareSnapshotsOptions{
ShareID: core.StringPtr(shareID),
}
}
// SetShareID : Allow user to set ShareID
func (_options *ListShareSnapshotsOptions) SetShareID(shareID string) *ListShareSnapshotsOptions {
_options.ShareID = core.StringPtr(shareID)
return _options
}
// SetBackupPolicyPlanID : Allow user to set BackupPolicyPlanID
func (_options *ListShareSnapshotsOptions) SetBackupPolicyPlanID(backupPolicyPlanID string) *ListShareSnapshotsOptions {
_options.BackupPolicyPlanID = core.StringPtr(backupPolicyPlanID)
return _options
}
// SetName : Allow user to set Name
func (_options *ListShareSnapshotsOptions) SetName(name string) *ListShareSnapshotsOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListShareSnapshotsOptions) SetStart(start string) *ListShareSnapshotsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListShareSnapshotsOptions) SetLimit(limit int64) *ListShareSnapshotsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetSort : Allow user to set Sort
func (_options *ListShareSnapshotsOptions) SetSort(sort string) *ListShareSnapshotsOptions {
_options.Sort = core.StringPtr(sort)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListShareSnapshotsOptions) SetHeaders(param map[string]string) *ListShareSnapshotsOptions {
options.Headers = param
return options
}
// ListSharesOptions : The ListShares options.
type ListSharesOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
Sort *string `json:"sort,omitempty"`
// Filters the collection to file shares with a `replication_role` property matching the specified value.
ReplicationRole *string `json:"replication_role,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListSharesOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
const (
ListSharesOptionsSortCreatedAtConst = "created_at"
ListSharesOptionsSortNameConst = "name"
)
// Constants associated with the ListSharesOptions.ReplicationRole property.
// Filters the collection to file shares with a `replication_role` property matching the specified value.
const (
ListSharesOptionsReplicationRoleNoneConst = "none"
ListSharesOptionsReplicationRoleReplicaConst = "replica"
ListSharesOptionsReplicationRoleSourceConst = "source"
)
// NewListSharesOptions : Instantiate ListSharesOptions
func (*VpcV1) NewListSharesOptions() *ListSharesOptions {
return &ListSharesOptions{}
}
// SetStart : Allow user to set Start
func (_options *ListSharesOptions) SetStart(start string) *ListSharesOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListSharesOptions) SetLimit(limit int64) *ListSharesOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetResourceGroupID : Allow user to set ResourceGroupID
func (_options *ListSharesOptions) SetResourceGroupID(resourceGroupID string) *ListSharesOptions {
_options.ResourceGroupID = core.StringPtr(resourceGroupID)
return _options
}
// SetName : Allow user to set Name
func (_options *ListSharesOptions) SetName(name string) *ListSharesOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetSort : Allow user to set Sort
func (_options *ListSharesOptions) SetSort(sort string) *ListSharesOptions {
_options.Sort = core.StringPtr(sort)
return _options
}
// SetReplicationRole : Allow user to set ReplicationRole
func (_options *ListSharesOptions) SetReplicationRole(replicationRole string) *ListSharesOptions {
_options.ReplicationRole = core.StringPtr(replicationRole)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListSharesOptions) SetHeaders(param map[string]string) *ListSharesOptions {
options.Headers = param
return options
}
// ListSnapshotClonesOptions : The ListSnapshotClones options.
type ListSnapshotClonesOptions struct {
// The snapshot identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListSnapshotClonesOptions : Instantiate ListSnapshotClonesOptions
func (*VpcV1) NewListSnapshotClonesOptions(id string) *ListSnapshotClonesOptions {
return &ListSnapshotClonesOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *ListSnapshotClonesOptions) SetID(id string) *ListSnapshotClonesOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListSnapshotClonesOptions) SetHeaders(param map[string]string) *ListSnapshotClonesOptions {
options.Headers = param
return options
}
// ListSnapshotConsistencyGroupsOptions : The ListSnapshotConsistencyGroups options.
type ListSnapshotConsistencyGroupsOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
Sort *string `json:"sort,omitempty"`
// Filters the collection to backup policy jobs with a `backup_policy_plan.id` property matching the specified
// identifier.
BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListSnapshotConsistencyGroupsOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
const (
ListSnapshotConsistencyGroupsOptionsSortCreatedAtConst = "created_at"
ListSnapshotConsistencyGroupsOptionsSortNameConst = "name"
)
// NewListSnapshotConsistencyGroupsOptions : Instantiate ListSnapshotConsistencyGroupsOptions
func (*VpcV1) NewListSnapshotConsistencyGroupsOptions() *ListSnapshotConsistencyGroupsOptions {
return &ListSnapshotConsistencyGroupsOptions{}
}
// SetStart : Allow user to set Start
func (_options *ListSnapshotConsistencyGroupsOptions) SetStart(start string) *ListSnapshotConsistencyGroupsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListSnapshotConsistencyGroupsOptions) SetLimit(limit int64) *ListSnapshotConsistencyGroupsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetResourceGroupID : Allow user to set ResourceGroupID
func (_options *ListSnapshotConsistencyGroupsOptions) SetResourceGroupID(resourceGroupID string) *ListSnapshotConsistencyGroupsOptions {
_options.ResourceGroupID = core.StringPtr(resourceGroupID)
return _options
}
// SetName : Allow user to set Name
func (_options *ListSnapshotConsistencyGroupsOptions) SetName(name string) *ListSnapshotConsistencyGroupsOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetSort : Allow user to set Sort
func (_options *ListSnapshotConsistencyGroupsOptions) SetSort(sort string) *ListSnapshotConsistencyGroupsOptions {
_options.Sort = core.StringPtr(sort)
return _options
}
// SetBackupPolicyPlanID : Allow user to set BackupPolicyPlanID
func (_options *ListSnapshotConsistencyGroupsOptions) SetBackupPolicyPlanID(backupPolicyPlanID string) *ListSnapshotConsistencyGroupsOptions {
_options.BackupPolicyPlanID = core.StringPtr(backupPolicyPlanID)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListSnapshotConsistencyGroupsOptions) SetHeaders(param map[string]string) *ListSnapshotConsistencyGroupsOptions {
options.Headers = param
return options
}
// ListSnapshotInstanceProfilesOptions : The ListSnapshotInstanceProfiles options.
type ListSnapshotInstanceProfilesOptions struct {
// The snapshot identifier.
ID *string `json:"id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListSnapshotInstanceProfilesOptions : Instantiate ListSnapshotInstanceProfilesOptions
func (*VpcV1) NewListSnapshotInstanceProfilesOptions(id string) *ListSnapshotInstanceProfilesOptions {
return &ListSnapshotInstanceProfilesOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *ListSnapshotInstanceProfilesOptions) SetID(id string) *ListSnapshotInstanceProfilesOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListSnapshotInstanceProfilesOptions) SetStart(start string) *ListSnapshotInstanceProfilesOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListSnapshotInstanceProfilesOptions) SetLimit(limit int64) *ListSnapshotInstanceProfilesOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListSnapshotInstanceProfilesOptions) SetHeaders(param map[string]string) *ListSnapshotInstanceProfilesOptions {
options.Headers = param
return options
}
// ListSnapshotsOptions : The ListSnapshots options.
type ListSnapshotsOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with an item in the `tags` property matching the exact specified tag.
Tag *string `json:"tag,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// Filters the collection to resources with a `source_volume.id` property matching the specified identifier.
SourceVolumeID *string `json:"source_volume.id,omitempty"`
// Filters the collection to resources with a `source_volume.crn` property matching the specified CRN.
SourceVolumeCRN *string `json:"source_volume.crn,omitempty"`
// Filters the collection to resources with a `source_image.id` property matching the specified identifier.
//
// This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no
// source image or any existent source image, respectively.
SourceImageID *string `json:"source_image.id,omitempty"`
// Filters the collection to resources with a `source_image.crn` property matching the specified CRN.
//
// This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no
// source image or any existent source image, respectively.
SourceImageCRN *string `json:"source_image.crn,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
Sort *string `json:"sort,omitempty"`
// Filters the collection to backup policy jobs with a `backup_policy_plan.id` property matching the specified
// identifier.
BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"`
// Filters the collection to snapshots with an item in the `copies` property with an `id` property matching the
// specified identifier.
CopiesID *string `json:"copies[].id,omitempty"`
// Filters the collection to snapshots with an item in the `copies` property with a `name` property matching the exact
// specified name.
CopiesName *string `json:"copies[].name,omitempty"`
// Filters the collection to snapshots with an item in the `copies` property with a `crn` property matching the
// specified CRN.
CopiesCRN *string `json:"copies[].crn,omitempty"`
// Filters the collection to snapshots with an item in the `copies` property with a
// `remote.region.name` property matching the exact specified name.
CopiesRemoteRegionName *string `json:"copies[].remote.region.name,omitempty"`
// Filters the collection to resources with a `source_snapshot.id` property matching the specified identifier.
SourceSnapshotID *string `json:"source_snapshot.id,omitempty"`
// Filters the collection to resources with a `source_snapshot.remote.region.name` property matching the exact
// specified name.
SourceSnapshotRemoteRegionName *string `json:"source_snapshot.remote.region.name,omitempty"`
// Filters the collection to resources with a `source_volume.remote.region.name` property matching the exact specified
// name.
SourceVolumeRemoteRegionName *string `json:"source_volume.remote.region.name,omitempty"`
// Filters the collection to resources with a `source_image.remote.region.name` property matching the exact specified
// name.
SourceImageRemoteRegionName *string `json:"source_image.remote.region.name,omitempty"`
// Filters the collection to snapshots with an item in the `clones` property with a `zone.name` property matching the
// exact specified name.
ClonesZoneName *string `json:"clones[].zone.name,omitempty"`
// Filters the collection to resources with a `snapshot_consistency_group.id` property matching the specified
// identifier.
SnapshotConsistencyGroupID *string `json:"snapshot_consistency_group.id,omitempty"`
// Filters the collection to resources with a `snapshot_consistency_group.crn` property matching the specified
// identifier.
SnapshotConsistencyGroupCRN *string `json:"snapshot_consistency_group.crn,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListSnapshotsOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
const (
ListSnapshotsOptionsSortCreatedAtConst = "created_at"
ListSnapshotsOptionsSortNameConst = "name"
)
// NewListSnapshotsOptions : Instantiate ListSnapshotsOptions
func (*VpcV1) NewListSnapshotsOptions() *ListSnapshotsOptions {
return &ListSnapshotsOptions{}
}
// SetStart : Allow user to set Start
func (_options *ListSnapshotsOptions) SetStart(start string) *ListSnapshotsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListSnapshotsOptions) SetLimit(limit int64) *ListSnapshotsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetTag : Allow user to set Tag
func (_options *ListSnapshotsOptions) SetTag(tag string) *ListSnapshotsOptions {
_options.Tag = core.StringPtr(tag)
return _options
}
// SetResourceGroupID : Allow user to set ResourceGroupID
func (_options *ListSnapshotsOptions) SetResourceGroupID(resourceGroupID string) *ListSnapshotsOptions {
_options.ResourceGroupID = core.StringPtr(resourceGroupID)
return _options
}
// SetName : Allow user to set Name
func (_options *ListSnapshotsOptions) SetName(name string) *ListSnapshotsOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetSourceVolumeID : Allow user to set SourceVolumeID
func (_options *ListSnapshotsOptions) SetSourceVolumeID(sourceVolumeID string) *ListSnapshotsOptions {
_options.SourceVolumeID = core.StringPtr(sourceVolumeID)
return _options
}
// SetSourceVolumeCRN : Allow user to set SourceVolumeCRN
func (_options *ListSnapshotsOptions) SetSourceVolumeCRN(sourceVolumeCRN string) *ListSnapshotsOptions {
_options.SourceVolumeCRN = core.StringPtr(sourceVolumeCRN)
return _options
}
// SetSourceImageID : Allow user to set SourceImageID
func (_options *ListSnapshotsOptions) SetSourceImageID(sourceImageID string) *ListSnapshotsOptions {
_options.SourceImageID = core.StringPtr(sourceImageID)
return _options
}
// SetSourceImageCRN : Allow user to set SourceImageCRN
func (_options *ListSnapshotsOptions) SetSourceImageCRN(sourceImageCRN string) *ListSnapshotsOptions {
_options.SourceImageCRN = core.StringPtr(sourceImageCRN)
return _options
}
// SetSort : Allow user to set Sort
func (_options *ListSnapshotsOptions) SetSort(sort string) *ListSnapshotsOptions {
_options.Sort = core.StringPtr(sort)
return _options
}
// SetBackupPolicyPlanID : Allow user to set BackupPolicyPlanID
func (_options *ListSnapshotsOptions) SetBackupPolicyPlanID(backupPolicyPlanID string) *ListSnapshotsOptions {
_options.BackupPolicyPlanID = core.StringPtr(backupPolicyPlanID)
return _options
}
// SetCopiesID : Allow user to set CopiesID
func (_options *ListSnapshotsOptions) SetCopiesID(copiesID string) *ListSnapshotsOptions {
_options.CopiesID = core.StringPtr(copiesID)
return _options
}
// SetCopiesName : Allow user to set CopiesName
func (_options *ListSnapshotsOptions) SetCopiesName(copiesName string) *ListSnapshotsOptions {
_options.CopiesName = core.StringPtr(copiesName)
return _options
}
// SetCopiesCRN : Allow user to set CopiesCRN
func (_options *ListSnapshotsOptions) SetCopiesCRN(copiesCRN string) *ListSnapshotsOptions {
_options.CopiesCRN = core.StringPtr(copiesCRN)
return _options
}
// SetCopiesRemoteRegionName : Allow user to set CopiesRemoteRegionName
func (_options *ListSnapshotsOptions) SetCopiesRemoteRegionName(copiesRemoteRegionName string) *ListSnapshotsOptions {
_options.CopiesRemoteRegionName = core.StringPtr(copiesRemoteRegionName)
return _options
}
// SetSourceSnapshotID : Allow user to set SourceSnapshotID
func (_options *ListSnapshotsOptions) SetSourceSnapshotID(sourceSnapshotID string) *ListSnapshotsOptions {
_options.SourceSnapshotID = core.StringPtr(sourceSnapshotID)
return _options
}
// SetSourceSnapshotRemoteRegionName : Allow user to set SourceSnapshotRemoteRegionName
func (_options *ListSnapshotsOptions) SetSourceSnapshotRemoteRegionName(sourceSnapshotRemoteRegionName string) *ListSnapshotsOptions {
_options.SourceSnapshotRemoteRegionName = core.StringPtr(sourceSnapshotRemoteRegionName)
return _options
}
// SetSourceVolumeRemoteRegionName : Allow user to set SourceVolumeRemoteRegionName
func (_options *ListSnapshotsOptions) SetSourceVolumeRemoteRegionName(sourceVolumeRemoteRegionName string) *ListSnapshotsOptions {
_options.SourceVolumeRemoteRegionName = core.StringPtr(sourceVolumeRemoteRegionName)
return _options
}
// SetSourceImageRemoteRegionName : Allow user to set SourceImageRemoteRegionName
func (_options *ListSnapshotsOptions) SetSourceImageRemoteRegionName(sourceImageRemoteRegionName string) *ListSnapshotsOptions {
_options.SourceImageRemoteRegionName = core.StringPtr(sourceImageRemoteRegionName)
return _options
}
// SetClonesZoneName : Allow user to set ClonesZoneName
func (_options *ListSnapshotsOptions) SetClonesZoneName(clonesZoneName string) *ListSnapshotsOptions {
_options.ClonesZoneName = core.StringPtr(clonesZoneName)
return _options
}
// SetSnapshotConsistencyGroupID : Allow user to set SnapshotConsistencyGroupID
func (_options *ListSnapshotsOptions) SetSnapshotConsistencyGroupID(snapshotConsistencyGroupID string) *ListSnapshotsOptions {
_options.SnapshotConsistencyGroupID = core.StringPtr(snapshotConsistencyGroupID)
return _options
}
// SetSnapshotConsistencyGroupCRN : Allow user to set SnapshotConsistencyGroupCRN
func (_options *ListSnapshotsOptions) SetSnapshotConsistencyGroupCRN(snapshotConsistencyGroupCRN string) *ListSnapshotsOptions {
_options.SnapshotConsistencyGroupCRN = core.StringPtr(snapshotConsistencyGroupCRN)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListSnapshotsOptions) SetHeaders(param map[string]string) *ListSnapshotsOptions {
options.Headers = param
return options
}
// ListSubnetReservedIpsOptions : The ListSubnetReservedIps options.
type ListSubnetReservedIpsOptions struct {
// The subnet identifier.
SubnetID *string `json:"subnet_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
Sort *string `json:"sort,omitempty"`
// Filters the collection to resources with a `target.id` property matching the specified identifier.
TargetID *string `json:"target.id,omitempty"`
// Filters the collection to resources with a `target.crn` property matching the specified CRN.
TargetCRN *string `json:"target.crn,omitempty"`
// Filters the collection to resources with a `target.name` property matching the exact specified name.
TargetName *string `json:"target.name,omitempty"`
// Filters the collection to resources with a `target.resource_type` property matching the specified value.
TargetResourceType *string `json:"target.resource_type,omitempty"`
// 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 property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property 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
}
// SetTargetID : Allow user to set TargetID
func (_options *ListSubnetReservedIpsOptions) SetTargetID(targetID string) *ListSubnetReservedIpsOptions {
_options.TargetID = core.StringPtr(targetID)
return _options
}
// SetTargetCRN : Allow user to set TargetCRN
func (_options *ListSubnetReservedIpsOptions) SetTargetCRN(targetCRN string) *ListSubnetReservedIpsOptions {
_options.TargetCRN = core.StringPtr(targetCRN)
return _options
}
// SetTargetName : Allow user to set TargetName
func (_options *ListSubnetReservedIpsOptions) SetTargetName(targetName string) *ListSubnetReservedIpsOptions {
_options.TargetName = core.StringPtr(targetName)
return _options
}
// SetTargetResourceType : Allow user to set TargetResourceType
func (_options *ListSubnetReservedIpsOptions) SetTargetResourceType(targetResourceType string) *ListSubnetReservedIpsOptions {
_options.TargetResourceType = core.StringPtr(targetResourceType)
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-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Filters the collection to resources with a `zone.name` property matching the exact specified name.
ZoneName *string `json:"zone.name,omitempty"`
// Filters the collection to resources with a `vpc.id` property matching the specified identifier.
VPCID *string `json:"vpc.id,omitempty"`
// Filters the collection to resources with a `vpc.crn` property matching the specified CRN.
VPCCRN *string `json:"vpc.crn,omitempty"`
// Filters the collection to resources with a `vpc.name` property matching the exact specified name.
VPCName *string `json:"vpc.name,omitempty"`
// Filters the collection to subnets with a `routing_table.id` property matching the specified identifier.
RoutingTableID *string `json:"routing_table.id,omitempty"`
// Filters the collection to subnets with a `routing_table.name` property matching the exact specified name.
RoutingTableName *string `json:"routing_table.name,omitempty"`
// 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
}
// SetZoneName : Allow user to set ZoneName
func (_options *ListSubnetsOptions) SetZoneName(zoneName string) *ListSubnetsOptions {
_options.ZoneName = core.StringPtr(zoneName)
return _options
}
// SetVPCID : Allow user to set VPCID
func (_options *ListSubnetsOptions) SetVPCID(vpcID string) *ListSubnetsOptions {
_options.VPCID = core.StringPtr(vpcID)
return _options
}
// SetVPCCRN : Allow user to set VPCCRN
func (_options *ListSubnetsOptions) SetVPCCRN(vpcCRN string) *ListSubnetsOptions {
_options.VPCCRN = core.StringPtr(vpcCRN)
return _options
}
// SetVPCName : Allow user to set VPCName
func (_options *ListSubnetsOptions) SetVPCName(vpcName string) *ListSubnetsOptions {
_options.VPCName = core.StringPtr(vpcName)
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
}
// ListVirtualNetworkInterfaceIpsOptions : The ListVirtualNetworkInterfaceIps options.
type ListVirtualNetworkInterfaceIpsOptions struct {
// The virtual network interface identifier.
VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value
// `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name`
// property in ascending order.
Sort *string `json:"sort,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListVirtualNetworkInterfaceIpsOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value
// `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name`
// property in ascending order.
const (
ListVirtualNetworkInterfaceIpsOptionsSortAddressConst = "address"
ListVirtualNetworkInterfaceIpsOptionsSortNameConst = "name"
)
// NewListVirtualNetworkInterfaceIpsOptions : Instantiate ListVirtualNetworkInterfaceIpsOptions
func (*VpcV1) NewListVirtualNetworkInterfaceIpsOptions(virtualNetworkInterfaceID string) *ListVirtualNetworkInterfaceIpsOptions {
return &ListVirtualNetworkInterfaceIpsOptions{
VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID),
}
}
// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID
func (_options *ListVirtualNetworkInterfaceIpsOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *ListVirtualNetworkInterfaceIpsOptions {
_options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListVirtualNetworkInterfaceIpsOptions) SetStart(start string) *ListVirtualNetworkInterfaceIpsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListVirtualNetworkInterfaceIpsOptions) SetLimit(limit int64) *ListVirtualNetworkInterfaceIpsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetSort : Allow user to set Sort
func (_options *ListVirtualNetworkInterfaceIpsOptions) SetSort(sort string) *ListVirtualNetworkInterfaceIpsOptions {
_options.Sort = core.StringPtr(sort)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListVirtualNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListVirtualNetworkInterfaceIpsOptions {
options.Headers = param
return options
}
// ListVirtualNetworkInterfacesOptions : The ListVirtualNetworkInterfaces options.
type ListVirtualNetworkInterfacesOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListVirtualNetworkInterfacesOptions : Instantiate ListVirtualNetworkInterfacesOptions
func (*VpcV1) NewListVirtualNetworkInterfacesOptions() *ListVirtualNetworkInterfacesOptions {
return &ListVirtualNetworkInterfacesOptions{}
}
// SetStart : Allow user to set Start
func (_options *ListVirtualNetworkInterfacesOptions) SetStart(start string) *ListVirtualNetworkInterfacesOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListVirtualNetworkInterfacesOptions) SetLimit(limit int64) *ListVirtualNetworkInterfacesOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetResourceGroupID : Allow user to set ResourceGroupID
func (_options *ListVirtualNetworkInterfacesOptions) SetResourceGroupID(resourceGroupID string) *ListVirtualNetworkInterfacesOptions {
_options.ResourceGroupID = core.StringPtr(resourceGroupID)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListVirtualNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListVirtualNetworkInterfacesOptions {
options.Headers = param
return options
}
// ListVolumeInstanceProfilesOptions : The ListVolumeInstanceProfiles options.
type ListVolumeInstanceProfilesOptions struct {
// The volume identifier.
ID *string `json:"id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListVolumeInstanceProfilesOptions : Instantiate ListVolumeInstanceProfilesOptions
func (*VpcV1) NewListVolumeInstanceProfilesOptions(id string) *ListVolumeInstanceProfilesOptions {
return &ListVolumeInstanceProfilesOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *ListVolumeInstanceProfilesOptions) SetID(id string) *ListVolumeInstanceProfilesOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListVolumeInstanceProfilesOptions) SetStart(start string) *ListVolumeInstanceProfilesOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListVolumeInstanceProfilesOptions) SetLimit(limit int64) *ListVolumeInstanceProfilesOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListVolumeInstanceProfilesOptions) SetHeaders(param map[string]string) *ListVolumeInstanceProfilesOptions {
options.Headers = param
return options
}
// ListVolumeProfilesOptions : The ListVolumeProfiles options.
type ListVolumeProfilesOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// 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-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to volumes with an `attachment_state` property matching the specified value.
AttachmentState *string `json:"attachment_state,omitempty"`
// Filters the collection to resources with an `encryption` property matching the specified value.
Encryption *string `json:"encryption,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// Filters the collection to resources with an `operating_system.family` property matching the specified operating
// system family.
//
// This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no
// operating system or any operating system, respectively.
OperatingSystemFamily *string `json:"operating_system.family,omitempty"`
// Filters the collection to resources with an `operating_system.architecture` property matching the specified
// operating system architecture.
//
// This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no
// operating system or any operating system, respectively.
OperatingSystemArchitecture *string `json:"operating_system.architecture,omitempty"`
// Filters the collection to resources with an item in the `tags` property matching the exact specified tag.
Tag *string `json:"tag,omitempty"`
// Filters the collection to resources with a `zone.name` property matching the exact specified name.
ZoneName *string `json:"zone.name,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListVolumesOptions.AttachmentState property.
// Filters the collection to volumes with an `attachment_state` property matching the specified value.
const (
ListVolumesOptionsAttachmentStateAttachedConst = "attached"
ListVolumesOptionsAttachmentStateUnattachedConst = "unattached"
ListVolumesOptionsAttachmentStateUnusableConst = "unusable"
)
// Constants associated with the ListVolumesOptions.Encryption property.
// Filters the collection to resources with an `encryption` property matching the specified value.
const (
ListVolumesOptionsEncryptionProviderManagedConst = "provider_managed"
ListVolumesOptionsEncryptionUserManagedConst = "user_managed"
)
// 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
}
// SetAttachmentState : Allow user to set AttachmentState
func (_options *ListVolumesOptions) SetAttachmentState(attachmentState string) *ListVolumesOptions {
_options.AttachmentState = core.StringPtr(attachmentState)
return _options
}
// SetEncryption : Allow user to set Encryption
func (_options *ListVolumesOptions) SetEncryption(encryption string) *ListVolumesOptions {
_options.Encryption = core.StringPtr(encryption)
return _options
}
// SetName : Allow user to set Name
func (_options *ListVolumesOptions) SetName(name string) *ListVolumesOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetOperatingSystemFamily : Allow user to set OperatingSystemFamily
func (_options *ListVolumesOptions) SetOperatingSystemFamily(operatingSystemFamily string) *ListVolumesOptions {
_options.OperatingSystemFamily = core.StringPtr(operatingSystemFamily)
return _options
}
// SetOperatingSystemArchitecture : Allow user to set OperatingSystemArchitecture
func (_options *ListVolumesOptions) SetOperatingSystemArchitecture(operatingSystemArchitecture string) *ListVolumesOptions {
_options.OperatingSystemArchitecture = core.StringPtr(operatingSystemArchitecture)
return _options
}
// SetTag : Allow user to set Tag
func (_options *ListVolumesOptions) SetTag(tag string) *ListVolumesOptions {
_options.Tag = core.StringPtr(tag)
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 `json:"vpc_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// 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
}
// ListVPCDnsResolutionBindingsOptions : The ListVPCDnsResolutionBindings options.
type ListVPCDnsResolutionBindingsOptions struct {
// The VPC identifier.
VPCID *string `json:"vpc_id" validate:"required,ne="`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
Sort *string `json:"sort,omitempty"`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// Filters the collection to resources with a `vpc.crn` property matching the specified CRN.
VPCCRN *string `json:"vpc.crn,omitempty"`
// Filters the collection to resources with a `vpc.name` property matching the exact specified name.
VPCName *string `json:"vpc.name,omitempty"`
// Filters the collection to resources with a `vpc.remote.account.id` property matching the specified account
// identifier.
AccountID *string `json:"account.id,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListVPCDnsResolutionBindingsOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
const (
ListVPCDnsResolutionBindingsOptionsSortCreatedAtConst = "created_at"
ListVPCDnsResolutionBindingsOptionsSortNameConst = "name"
)
// NewListVPCDnsResolutionBindingsOptions : Instantiate ListVPCDnsResolutionBindingsOptions
func (*VpcV1) NewListVPCDnsResolutionBindingsOptions(vpcID string) *ListVPCDnsResolutionBindingsOptions {
return &ListVPCDnsResolutionBindingsOptions{
VPCID: core.StringPtr(vpcID),
}
}
// SetVPCID : Allow user to set VPCID
func (_options *ListVPCDnsResolutionBindingsOptions) SetVPCID(vpcID string) *ListVPCDnsResolutionBindingsOptions {
_options.VPCID = core.StringPtr(vpcID)
return _options
}
// SetSort : Allow user to set Sort
func (_options *ListVPCDnsResolutionBindingsOptions) SetSort(sort string) *ListVPCDnsResolutionBindingsOptions {
_options.Sort = core.StringPtr(sort)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListVPCDnsResolutionBindingsOptions) SetStart(start string) *ListVPCDnsResolutionBindingsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListVPCDnsResolutionBindingsOptions) SetLimit(limit int64) *ListVPCDnsResolutionBindingsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetName : Allow user to set Name
func (_options *ListVPCDnsResolutionBindingsOptions) SetName(name string) *ListVPCDnsResolutionBindingsOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetVPCCRN : Allow user to set VPCCRN
func (_options *ListVPCDnsResolutionBindingsOptions) SetVPCCRN(vpcCRN string) *ListVPCDnsResolutionBindingsOptions {
_options.VPCCRN = core.StringPtr(vpcCRN)
return _options
}
// SetVPCName : Allow user to set VPCName
func (_options *ListVPCDnsResolutionBindingsOptions) SetVPCName(vpcName string) *ListVPCDnsResolutionBindingsOptions {
_options.VPCName = core.StringPtr(vpcName)
return _options
}
// SetAccountID : Allow user to set AccountID
func (_options *ListVPCDnsResolutionBindingsOptions) SetAccountID(accountID string) *ListVPCDnsResolutionBindingsOptions {
_options.AccountID = core.StringPtr(accountID)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListVPCDnsResolutionBindingsOptions) SetHeaders(param map[string]string) *ListVPCDnsResolutionBindingsOptions {
options.Headers = param
return options
}
// ListVPCRoutesOptions : The ListVPCRoutes options.
type ListVPCRoutesOptions struct {
// The VPC identifier.
VPCID *string `json:"vpc_id" validate:"required,ne="`
// Filters the collection to resources with a `zone.name` property matching the exact specified name.
ZoneName *string `json:"zone.name,omitempty"`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// 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 `json:"vpc_id" validate:"required,ne="`
// The routing table identifier.
RoutingTableID *string `json:"routing_table_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// 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 `json:"vpc_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to routing tables with an `is_default` property matching the specified value.
IsDefault *bool `json:"is_default,omitempty"`
// 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-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Filters the collection to VPCs with a `classic_access` property matching the specified value.
ClassicAccess *bool `json:"classic_access,omitempty"`
// 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
}
// ListVPNGatewayConnectionsLocalCIDRsOptions : The ListVPNGatewayConnectionsLocalCIDRs options.
type ListVPNGatewayConnectionsLocalCIDRsOptions struct {
// The VPN gateway identifier.
VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="`
// The VPN gateway connection identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListVPNGatewayConnectionsLocalCIDRsOptions : Instantiate ListVPNGatewayConnectionsLocalCIDRsOptions
func (*VpcV1) NewListVPNGatewayConnectionsLocalCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionsLocalCIDRsOptions {
return &ListVPNGatewayConnectionsLocalCIDRsOptions{
VPNGatewayID: core.StringPtr(vpnGatewayID),
ID: core.StringPtr(id),
}
}
// SetVPNGatewayID : Allow user to set VPNGatewayID
func (_options *ListVPNGatewayConnectionsLocalCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionsLocalCIDRsOptions {
_options.VPNGatewayID = core.StringPtr(vpnGatewayID)
return _options
}
// SetID : Allow user to set ID
func (_options *ListVPNGatewayConnectionsLocalCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionsLocalCIDRsOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListVPNGatewayConnectionsLocalCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionsLocalCIDRsOptions {
options.Headers = param
return options
}
// ListVPNGatewayConnectionsOptions : The ListVPNGatewayConnections options.
type ListVPNGatewayConnectionsOptions struct {
// The VPN gateway identifier.
VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to VPN gateway connections with a `status` property matching the specified value.
Status *string `json:"status,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListVPNGatewayConnectionsOptions.Status property.
// Filters the collection to VPN gateway connections with a `status` property matching the specified value.
const (
ListVPNGatewayConnectionsOptionsStatusDownConst = "down"
ListVPNGatewayConnectionsOptionsStatusUpConst = "up"
)
// 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
}
// SetStart : Allow user to set Start
func (_options *ListVPNGatewayConnectionsOptions) SetStart(start string) *ListVPNGatewayConnectionsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListVPNGatewayConnectionsOptions) SetLimit(limit int64) *ListVPNGatewayConnectionsOptions {
_options.Limit = core.Int64Ptr(limit)
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
}
// ListVPNGatewayConnectionsPeerCIDRsOptions : The ListVPNGatewayConnectionsPeerCIDRs options.
type ListVPNGatewayConnectionsPeerCIDRsOptions struct {
// The VPN gateway identifier.
VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="`
// The VPN gateway connection identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewListVPNGatewayConnectionsPeerCIDRsOptions : Instantiate ListVPNGatewayConnectionsPeerCIDRsOptions
func (*VpcV1) NewListVPNGatewayConnectionsPeerCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionsPeerCIDRsOptions {
return &ListVPNGatewayConnectionsPeerCIDRsOptions{
VPNGatewayID: core.StringPtr(vpnGatewayID),
ID: core.StringPtr(id),
}
}
// SetVPNGatewayID : Allow user to set VPNGatewayID
func (_options *ListVPNGatewayConnectionsPeerCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionsPeerCIDRsOptions {
_options.VPNGatewayID = core.StringPtr(vpnGatewayID)
return _options
}
// SetID : Allow user to set ID
func (_options *ListVPNGatewayConnectionsPeerCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionsPeerCIDRsOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListVPNGatewayConnectionsPeerCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionsPeerCIDRsOptions {
options.Headers = param
return options
}
// ListVPNGatewaysOptions : The ListVPNGateways options.
type ListVPNGatewaysOptions struct {
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
Sort *string `json:"sort,omitempty"`
// Filters the collection to VPN gateways with a `mode` property matching the specified value.
Mode *string `json:"mode,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListVPNGatewaysOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
const (
ListVPNGatewaysOptionsSortCreatedAtConst = "created_at"
ListVPNGatewaysOptionsSortNameConst = "name"
)
// Constants associated with the ListVPNGatewaysOptions.Mode property.
// Filters the collection to VPN gateways with a `mode` property matching the specified value.
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
}
// SetSort : Allow user to set Sort
func (_options *ListVPNGatewaysOptions) SetSort(sort string) *ListVPNGatewaysOptions {
_options.Sort = core.StringPtr(sort)
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
}
// ListVPNServerClientsOptions : The ListVPNServerClients options.
type ListVPNServerClientsOptions struct {
// The VPN server identifier.
VPNServerID *string `json:"vpn_server_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order.
Sort *string `json:"sort,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListVPNServerClientsOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order.
const (
ListVPNServerClientsOptionsSortCreatedAtConst = "created_at"
)
// NewListVPNServerClientsOptions : Instantiate ListVPNServerClientsOptions
func (*VpcV1) NewListVPNServerClientsOptions(vpnServerID string) *ListVPNServerClientsOptions {
return &ListVPNServerClientsOptions{
VPNServerID: core.StringPtr(vpnServerID),
}
}
// SetVPNServerID : Allow user to set VPNServerID
func (_options *ListVPNServerClientsOptions) SetVPNServerID(vpnServerID string) *ListVPNServerClientsOptions {
_options.VPNServerID = core.StringPtr(vpnServerID)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListVPNServerClientsOptions) SetStart(start string) *ListVPNServerClientsOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListVPNServerClientsOptions) SetLimit(limit int64) *ListVPNServerClientsOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetSort : Allow user to set Sort
func (_options *ListVPNServerClientsOptions) SetSort(sort string) *ListVPNServerClientsOptions {
_options.Sort = core.StringPtr(sort)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListVPNServerClientsOptions) SetHeaders(param map[string]string) *ListVPNServerClientsOptions {
options.Headers = param
return options
}
// ListVPNServerRoutesOptions : The ListVPNServerRoutes options.
type ListVPNServerRoutesOptions struct {
// The VPN server identifier.
VPNServerID *string `json:"vpn_server_id" validate:"required,ne="`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
Sort *string `json:"sort,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListVPNServerRoutesOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
const (
ListVPNServerRoutesOptionsSortCreatedAtConst = "created_at"
ListVPNServerRoutesOptionsSortNameConst = "name"
)
// NewListVPNServerRoutesOptions : Instantiate ListVPNServerRoutesOptions
func (*VpcV1) NewListVPNServerRoutesOptions(vpnServerID string) *ListVPNServerRoutesOptions {
return &ListVPNServerRoutesOptions{
VPNServerID: core.StringPtr(vpnServerID),
}
}
// SetVPNServerID : Allow user to set VPNServerID
func (_options *ListVPNServerRoutesOptions) SetVPNServerID(vpnServerID string) *ListVPNServerRoutesOptions {
_options.VPNServerID = core.StringPtr(vpnServerID)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListVPNServerRoutesOptions) SetStart(start string) *ListVPNServerRoutesOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListVPNServerRoutesOptions) SetLimit(limit int64) *ListVPNServerRoutesOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetSort : Allow user to set Sort
func (_options *ListVPNServerRoutesOptions) SetSort(sort string) *ListVPNServerRoutesOptions {
_options.Sort = core.StringPtr(sort)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListVPNServerRoutesOptions) SetHeaders(param map[string]string) *ListVPNServerRoutesOptions {
options.Headers = param
return options
}
// ListVPNServersOptions : The ListVPNServers options.
type ListVPNServersOptions struct {
// Filters the collection to resources with a `name` property matching the exact specified name.
Name *string `json:"name,omitempty"`
// A server-provided token determining what resource to start the page on.
Start *string `json:"start,omitempty"`
// The number of resources to return on a page.
Limit *int64 `json:"limit,omitempty"`
// Filters the collection to resources with a `resource_group.id` property matching the specified identifier.
ResourceGroupID *string `json:"resource_group.id,omitempty"`
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
Sort *string `json:"sort,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the ListVPNServersOptions.Sort property.
// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name
// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property
// in descending order, and the value `name` sorts it by the `name` property in ascending order.
const (
ListVPNServersOptionsSortCreatedAtConst = "created_at"
ListVPNServersOptionsSortNameConst = "name"
)
// NewListVPNServersOptions : Instantiate ListVPNServersOptions
func (*VpcV1) NewListVPNServersOptions() *ListVPNServersOptions {
return &ListVPNServersOptions{}
}
// SetName : Allow user to set Name
func (_options *ListVPNServersOptions) SetName(name string) *ListVPNServersOptions {
_options.Name = core.StringPtr(name)
return _options
}
// SetStart : Allow user to set Start
func (_options *ListVPNServersOptions) SetStart(start string) *ListVPNServersOptions {
_options.Start = core.StringPtr(start)
return _options
}
// SetLimit : Allow user to set Limit
func (_options *ListVPNServersOptions) SetLimit(limit int64) *ListVPNServersOptions {
_options.Limit = core.Int64Ptr(limit)
return _options
}
// SetResourceGroupID : Allow user to set ResourceGroupID
func (_options *ListVPNServersOptions) SetResourceGroupID(resourceGroupID string) *ListVPNServersOptions {
_options.ResourceGroupID = core.StringPtr(resourceGroupID)
return _options
}
// SetSort : Allow user to set Sort
func (_options *ListVPNServersOptions) SetSort(sort string) *ListVPNServersOptions {
_options.Sort = core.StringPtr(sort)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ListVPNServersOptions) SetHeaders(param map[string]string) *ListVPNServersOptions {
options.Headers = param
return options
}
// LoadBalancer : LoadBalancer struct
type LoadBalancer struct {
// The access mode for this load balancer:
// - `private`: reachable from within its VPC, at IP addresses in `private_ips`
// - `private_path`: reachable through an endpoint gateway
// - `public`: reachable from the internet at the IP addresses in `public_ips`.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
AccessMode *string `json:"access_mode" validate:"required"`
// The load balancer pool members attached to this load balancer.
AttachedLoadBalancerPoolMembers []LoadBalancerPoolMemberReference `json:"attached_load_balancer_pool_members" validate:"required"`
// The availability of this load balancer:
// - `subnet`: remains available if at least one zone that the load balancer's subnets reside
// in is available
// - `region`: remains available if at least one zone in the region is available.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Availability *string `json:"availability" validate:"required"`
// The date and time that this load balancer was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The CRN for this load balancer.
CRN *string `json:"crn" validate:"required"`
// The DNS configuration for this load balancer.
//
// If absent, DNS `A` records for this load balancer's `hostname` property will be added to
// the public DNS zone `lb.appdomain.cloud`.
//
// Not supported by private path load balancers.
Dns *LoadBalancerDns `json:"dns,omitempty"`
// The supported `failsafe_policy.action` values for this load balancer's pools.
FailsafePolicyActions []string `json:"failsafe_policy_actions" validate:"required"`
// The fully qualified domain name assigned to this load balancer.
Hostname *string `json:"hostname" validate:"required"`
// The URL for this load balancer.
Href *string `json:"href" validate:"required"`
// The unique identifier for this load balancer.
ID *string `json:"id" validate:"required"`
// Indicates whether this load balancer supports instance groups.
InstanceGroupsSupported *bool `json:"instance_groups_supported" validate:"required"`
// Indicates whether this is a private path load balancer.
IsPrivatePath *bool `json:"is_private_path" 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 name for this load balancer. The name is unique across all load balancers in the VPC.
Name *string `json:"name" validate:"required"`
// The operating status of this load balancer.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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.
//
// Will be empty if `is_private` is `false`.
PrivateIps []ReservedIPReference `json:"private_ips" validate:"required"`
// The profile for this load balancer.
Profile *LoadBalancerProfileReference `json:"profile" validate:"required"`
// The provisioning status of this load balancer:
// - `active`: The load balancer is running.
// - `create_pending`: The load balancer is being created.
// - `delete_pending`: The load balancer is being deleted.
// - `maintenance_pending`: The load balancer is unavailable due to an internal
// error (contact IBM support).
// - `migrate_pending`: The load balancer is migrating to the requested configuration.
// Performance may be degraded.
// - `update_pending`: The load balancer is being updated
// to the requested configuration.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
ProvisioningStatus *string `json:"provisioning_status" validate:"required"`
// The public IP addresses assigned to this load balancer.
//
// Will be empty if `is_public` is `false`.
PublicIps []IP `json:"public_ips" validate:"required"`
// The resource group for this load balancer.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// Indicates whether [route mode](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-vnf&interface=ui) is enabled for this
// load balancer.
//
// At present, public load balancers are not supported with route mode enabled.
RouteMode *bool `json:"route_mode" validate:"required"`
// The security groups targeting this load balancer.
//
// If empty, all inbound and outbound traffic is allowed.
SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"`
// Indicates whether this load balancer supports security groups.
SecurityGroupsSupported *bool `json:"security_groups_supported" validate:"required"`
// Indicates whether this load balancer supports source IP session persistence.
SourceIPSessionPersistenceSupported *bool `json:"source_ip_session_persistence_supported" validate:"required"`
// The subnets this load balancer is provisioned in.
//
// All subnets will be in the same VPC.
Subnets []SubnetReference `json:"subnets" validate:"required"`
// Indicates whether this load balancer supports UDP.
UDPSupported *bool `json:"udp_supported" validate:"required"`
}
// Constants associated with the LoadBalancer.AccessMode property.
// The access mode for this load balancer:
// - `private`: reachable from within its VPC, at IP addresses in `private_ips`
// - `private_path`: reachable through an endpoint gateway
// - `public`: reachable from the internet at the IP addresses in `public_ips`.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerAccessModePrivateConst = "private"
LoadBalancerAccessModePrivatePathConst = "private_path"
LoadBalancerAccessModePublicConst = "public"
)
// Constants associated with the LoadBalancer.Availability property.
// The availability of this load balancer:
// - `subnet`: remains available if at least one zone that the load balancer's subnets reside
// in is available
// - `region`: remains available if at least one zone in the region is available.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerAvailabilityRegionConst = "region"
LoadBalancerAvailabilitySubnetConst = "subnet"
)
// Constants associated with the LoadBalancer.FailsafePolicyActions property.
// A load balancer failsafe policy action:
// - `bypass`: Bypasses the members and sends requests directly to their destination IPs.
// - `drop`: Drops requests.
// - `fail`: Fails requests with an HTTP `503` status code.
// - `forward`: Forwards requests to the `target` pool.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerFailsafePolicyActionsBypassConst = "bypass"
LoadBalancerFailsafePolicyActionsDropConst = "drop"
LoadBalancerFailsafePolicyActionsFailConst = "fail"
LoadBalancerFailsafePolicyActionsForwardConst = "forward"
)
// Constants associated with the LoadBalancer.OperatingStatus property.
// The operating status of this load balancer.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerOperatingStatusOfflineConst = "offline"
LoadBalancerOperatingStatusOnlineConst = "online"
)
// Constants associated with the LoadBalancer.ProvisioningStatus property.
// The provisioning status of this load balancer:
// - `active`: The load balancer is running.
// - `create_pending`: The load balancer is being created.
// - `delete_pending`: The load balancer is being deleted.
// - `maintenance_pending`: The load balancer is unavailable due to an internal
// error (contact IBM support).
// - `migrate_pending`: The load balancer is migrating to the requested configuration.
// Performance may be degraded.
// - `update_pending`: The load balancer is being updated
// to the requested configuration.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerProvisioningStatusActiveConst = "active"
LoadBalancerProvisioningStatusCreatePendingConst = "create_pending"
LoadBalancerProvisioningStatusDeletePendingConst = "delete_pending"
LoadBalancerProvisioningStatusFailedConst = "failed"
LoadBalancerProvisioningStatusMaintenancePendingConst = "maintenance_pending"
LoadBalancerProvisioningStatusMigratePendingConst = "migrate_pending"
LoadBalancerProvisioningStatusUpdatePendingConst = "update_pending"
)
// Constants associated with the LoadBalancer.ResourceType property.
// The resource type.
const (
LoadBalancerResourceTypeLoadBalancerConst = "load_balancer"
)
// 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, "access_mode", &obj.AccessMode)
if err != nil {
err = core.SDKErrorf(err, "", "access_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "attached_load_balancer_pool_members", &obj.AttachedLoadBalancerPoolMembers, UnmarshalLoadBalancerPoolMemberReference)
if err != nil {
err = core.SDKErrorf(err, "", "attached_load_balancer_pool_members-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "availability", &obj.Availability)
if err != nil {
err = core.SDKErrorf(err, "", "availability-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalLoadBalancerDns)
if err != nil {
err = core.SDKErrorf(err, "", "dns-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "failsafe_policy_actions", &obj.FailsafePolicyActions)
if err != nil {
err = core.SDKErrorf(err, "", "failsafe_policy_actions-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname)
if err != nil {
err = core.SDKErrorf(err, "", "hostname-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "instance_groups_supported", &obj.InstanceGroupsSupported)
if err != nil {
err = core.SDKErrorf(err, "", "instance_groups_supported-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "is_private_path", &obj.IsPrivatePath)
if err != nil {
err = core.SDKErrorf(err, "", "is_private_path-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "is_public", &obj.IsPublic)
if err != nil {
err = core.SDKErrorf(err, "", "is_public-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "listeners", &obj.Listeners, UnmarshalLoadBalancerListenerReference)
if err != nil {
err = core.SDKErrorf(err, "", "listeners-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLogging)
if err != nil {
err = core.SDKErrorf(err, "", "logging-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "operating_status", &obj.OperatingStatus)
if err != nil {
err = core.SDKErrorf(err, "", "operating_status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "pools", &obj.Pools, UnmarshalLoadBalancerPoolReference)
if err != nil {
err = core.SDKErrorf(err, "", "pools-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "private_ips-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalLoadBalancerProfileReference)
if err != nil {
err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus)
if err != nil {
err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "public_ips", &obj.PublicIps, UnmarshalIP)
if err != nil {
err = core.SDKErrorf(err, "", "public_ips-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "route_mode", &obj.RouteMode)
if err != nil {
err = core.SDKErrorf(err, "", "route_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "security_groups_supported", &obj.SecurityGroupsSupported)
if err != nil {
err = core.SDKErrorf(err, "", "security_groups_supported-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "source_ip_session_persistence_supported", &obj.SourceIPSessionPersistenceSupported)
if err != nil {
err = core.SDKErrorf(err, "", "source_ip_session_persistence_supported-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "udp_supported", &obj.UDPSupported)
if err != nil {
err = core.SDKErrorf(err, "", "udp_supported-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerCollection : LoadBalancerCollection struct
type LoadBalancerCollection struct {
// A link to the first page of resources.
First *PageLink `json:"first" validate:"required"`
// The maximum number of resources that can be returned by the request.
Limit *int64 `json:"limit" validate:"required"`
// A page of load balancers.
LoadBalancers []LoadBalancer `json:"load_balancers" validate:"required"`
// A link to the next page of resources. This property is present for all pages
// except the last page.
Next *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" 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, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "load_balancers", &obj.LoadBalancers, UnmarshalLoadBalancer)
if err != nil {
err = core.SDKErrorf(err, "", "load_balancers-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *LoadBalancerCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// LoadBalancerDns : The DNS configuration for this load balancer.
//
// If absent, DNS `A` records for this load balancer's `hostname` property will be added to the public DNS zone
// `lb.appdomain.cloud`.
//
// Not supported by private path load balancers.
type LoadBalancerDns struct {
// The DNS instance associated with this load balancer.
Instance *DnsInstanceReferenceLoadBalancerDnsContext `json:"instance" validate:"required"`
// The DNS zone associated with this load balancer.
Zone *DnsZoneReference `json:"zone" validate:"required"`
}
// UnmarshalLoadBalancerDns unmarshals an instance of LoadBalancerDns from the specified map of raw messages.
func UnmarshalLoadBalancerDns(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerDns)
err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceReferenceLoadBalancerDnsContext)
if err != nil {
err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerDnsPatch : The DNS configuration for this load balancer.
//
// Specify `null` to remove the existing DNS configuration, which will remove all DNS `A` records for this load balancer
// that had been added to `zone`, and add equivalent `A` records to the public DNS zone `lb.appdomain.cloud`.
//
// Not supported by private path load balancers.
type LoadBalancerDnsPatch struct {
// The DNS instance to associate with this load balancer.
//
// The specified instance may be in a different region or account, subject to IAM
// policies.
Instance DnsInstanceIdentityIntf `json:"instance,omitempty"`
// The DNS zone to associate with this load balancer.
//
// The specified zone may be in a different region or account, subject to IAM policies.
Zone DnsZoneIdentityIntf `json:"zone,omitempty"`
}
// UnmarshalLoadBalancerDnsPatch unmarshals an instance of LoadBalancerDnsPatch from the specified map of raw messages.
func UnmarshalLoadBalancerDnsPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerDnsPatch)
err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the LoadBalancerDnsPatch
func (loadBalancerDnsPatch *LoadBalancerDnsPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerDnsPatch.Instance) {
_patch["instance"] = loadBalancerDnsPatch.Instance.asPatch()
}
if !core.IsNil(loadBalancerDnsPatch.Zone) {
_patch["zone"] = loadBalancerDnsPatch.Zone.asPatch()
}
return
}
// LoadBalancerDnsPrototype : The DNS configuration for this load balancer.
//
// If unspecified, DNS `A` records for this load balancer's `hostname` property will be added to the public DNS zone
// `lb.appdomain.cloud`. Otherwise, those DNS `A` records will be added to the specified `zone`.
//
// Not supported by private path load balancers.
type LoadBalancerDnsPrototype struct {
// The DNS instance to associate with this load balancer.
//
// The specified instance may be in a different region or account, subject to IAM
// policies.
Instance DnsInstanceIdentityIntf `json:"instance" validate:"required"`
// The DNS zone to associate with this load balancer.
//
// The specified zone may be in a different region or account, subject to IAM policies.
Zone DnsZoneIdentityIntf `json:"zone" validate:"required"`
}
// NewLoadBalancerDnsPrototype : Instantiate LoadBalancerDnsPrototype (Generic Model Constructor)
func (*VpcV1) NewLoadBalancerDnsPrototype(instance DnsInstanceIdentityIntf, zone DnsZoneIdentityIntf) (_model *LoadBalancerDnsPrototype, err error) {
_model = &LoadBalancerDnsPrototype{
Instance: instance,
Zone: zone,
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalLoadBalancerDnsPrototype unmarshals an instance of LoadBalancerDnsPrototype from the specified map of raw messages.
func UnmarshalLoadBalancerDnsPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerDnsPrototype)
err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
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 CRN for this load balancer.
CRN *string `json:"crn,omitempty"`
// The URL for this load balancer.
Href *string `json:"href,omitempty"`
}
func (*LoadBalancerIdentity) isaLoadBalancerIdentity() bool {
return true
}
type LoadBalancerIdentityIntf interface {
isaLoadBalancerIdentity() bool
asPatch() map[string]interface{}
}
// 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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the LoadBalancerIdentity
func (loadBalancerIdentity *LoadBalancerIdentity) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerIdentity.ID) {
_patch["id"] = loadBalancerIdentity.ID
}
if !core.IsNil(loadBalancerIdentity.CRN) {
_patch["crn"] = loadBalancerIdentity.CRN
}
if !core.IsNil(loadBalancerIdentity.Href) {
_patch["href"] = loadBalancerIdentity.Href
}
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`). Additional restrictions:
// - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must
// match the `accept_proxy_protocol` value of the `https_redirect` listener.
// - If this listener is the target of another listener's `https_redirect`, its
// `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value.
AcceptProxyProtocol *bool `json:"accept_proxy_protocol" validate:"required"`
// The certificate instance used for SSL termination.
//
// If absent, this listener is not using a certificate instance.
CertificateInstance *CertificateInstanceReference `json:"certificate_instance,omitempty"`
// The concurrent connection limit for the listener. If reached, incoming connections may be queued or rejected.
//
// This property will be present for load balancers in the `application` family.
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 for this listener. If absent, this listener has no default pool.
//
// If `https_redirect` is set, the default pool will not be used.
DefaultPool *LoadBalancerPoolReference `json:"default_pool,omitempty"`
// The URL for this load balancer listener.
Href *string `json:"href" validate:"required"`
// If present, the target listener that requests are redirected to if none of the
// listener's `policies` match.
HTTPSRedirect *LoadBalancerListenerHTTPSRedirect `json:"https_redirect,omitempty"`
// The unique identifier for this load balancer listener.
ID *string `json:"id" validate:"required"`
// The idle connection timeout of the listener in seconds.
//
// This property will be present for load balancers in the `application` family.
IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"`
// The policies for this listener.
Policies []LoadBalancerListenerPolicyReference `json:"policies,omitempty"`
// The listener port number, or the inclusive lower bound of the port range.
Port *int64 `json:"port" validate:"required"`
// The inclusive upper bound of the range of ports used by this listener.
PortMax *int64 `json:"port_max" validate:"required"`
// The inclusive lower bound of the range of ports used by this listener.
PortMin *int64 `json:"port_min" validate:"required"`
// The listener protocol.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Protocol *string `json:"protocol" validate:"required"`
// The provisioning status of this listener
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
ProvisioningStatus *string `json:"provisioning_status" validate:"required"`
}
// Constants associated with the LoadBalancerListener.Protocol property.
// The listener protocol.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerListenerProtocolHTTPConst = "http"
LoadBalancerListenerProtocolHTTPSConst = "https"
LoadBalancerListenerProtocolTCPConst = "tcp"
LoadBalancerListenerProtocolUDPConst = "udp"
)
// Constants associated with the LoadBalancerListener.ProvisioningStatus property.
// The provisioning status of this listener
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerListenerProvisioningStatusActiveConst = "active"
LoadBalancerListenerProvisioningStatusCreatePendingConst = "create_pending"
LoadBalancerListenerProvisioningStatusDeletePendingConst = "delete_pending"
LoadBalancerListenerProvisioningStatusFailedConst = "failed"
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 {
err = core.SDKErrorf(err, "", "accept_proxy_protocol-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceReference)
if err != nil {
err = core.SDKErrorf(err, "", "certificate_instance-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit)
if err != nil {
err = core.SDKErrorf(err, "", "connection_limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolReference)
if err != nil {
err = core.SDKErrorf(err, "", "default_pool-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirect)
if err != nil {
err = core.SDKErrorf(err, "", "https_redirect-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout)
if err != nil {
err = core.SDKErrorf(err, "", "idle_connection_timeout-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicyReference)
if err != nil {
err = core.SDKErrorf(err, "", "policies-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port", &obj.Port)
if err != nil {
err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax)
if err != nil {
err = core.SDKErrorf(err, "", "port_max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin)
if err != nil {
err = core.SDKErrorf(err, "", "port_min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol)
if err != nil {
err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus)
if err != nil {
err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerListenerCollection : LoadBalancerListenerCollection struct
type LoadBalancerListenerCollection struct {
// The listeners for the load balancer.
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 {
err = core.SDKErrorf(err, "", "listeners-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerListenerDefaultPoolPatch : The default pool for this listener. If `https_redirect` is set, the default pool will not be used. The specified pool
// must:
//
// - Belong to this load balancer
// - Have the same `protocol` as this listener, or have a compatible protocol.
// At present, the compatible protocols are `http` and `https`.
// - Not already be the `default_pool` for another listener
//
// Specify `null` to remove an existing default pool.
// Models which "extend" this model:
// - LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID
// - LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref
type LoadBalancerListenerDefaultPoolPatch struct {
// The unique identifier for this load balancer pool.
ID *string `json:"id,omitempty"`
// The URL for this load balancer pool.
Href *string `json:"href,omitempty"`
}
func (*LoadBalancerListenerDefaultPoolPatch) isaLoadBalancerListenerDefaultPoolPatch() bool {
return true
}
type LoadBalancerListenerDefaultPoolPatchIntf interface {
isaLoadBalancerListenerDefaultPoolPatch() bool
asPatch() map[string]interface{}
}
// UnmarshalLoadBalancerListenerDefaultPoolPatch unmarshals an instance of LoadBalancerListenerDefaultPoolPatch from the specified map of raw messages.
func UnmarshalLoadBalancerListenerDefaultPoolPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerListenerDefaultPoolPatch)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the LoadBalancerListenerDefaultPoolPatch
func (loadBalancerListenerDefaultPoolPatch *LoadBalancerListenerDefaultPoolPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerListenerDefaultPoolPatch.ID) {
_patch["id"] = loadBalancerListenerDefaultPoolPatch.ID
}
if !core.IsNil(loadBalancerListenerDefaultPoolPatch.Href) {
_patch["href"] = loadBalancerListenerDefaultPoolPatch.Href
}
return
}
// LoadBalancerListenerHTTPSRedirect : LoadBalancerListenerHTTPSRedirect struct
type LoadBalancerListenerHTTPSRedirect struct {
// The HTTP status code for this redirect.
HTTPStatusCode *int64 `json:"http_status_code" validate:"required"`
Listener *LoadBalancerListenerReference `json:"listener" validate:"required"`
// The redirect relative target URI.
URI *string `json:"uri,omitempty"`
}
// UnmarshalLoadBalancerListenerHTTPSRedirect unmarshals an instance of LoadBalancerListenerHTTPSRedirect from the specified map of raw messages.
func UnmarshalLoadBalancerListenerHTTPSRedirect(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerListenerHTTPSRedirect)
err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode)
if err != nil {
err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference)
if err != nil {
err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "uri", &obj.URI)
if err != nil {
err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerListenerHTTPSRedirectPatch : LoadBalancerListenerHTTPSRedirectPatch struct
type LoadBalancerListenerHTTPSRedirectPatch struct {
// The HTTP status code for this redirect.
HTTPStatusCode *int64 `json:"http_status_code,omitempty"`
// The target listener.
//
// The target listener must be in this load balancer, and must not be the same as the
// listener in the URL.
Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"`
// The redirect relative target URI.
URI *string `json:"uri,omitempty"`
}
// UnmarshalLoadBalancerListenerHTTPSRedirectPatch unmarshals an instance of LoadBalancerListenerHTTPSRedirectPatch from the specified map of raw messages.
func UnmarshalLoadBalancerListenerHTTPSRedirectPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerListenerHTTPSRedirectPatch)
err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode)
if err != nil {
err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "uri", &obj.URI)
if err != nil {
err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the LoadBalancerListenerHTTPSRedirectPatch
func (loadBalancerListenerHTTPSRedirectPatch *LoadBalancerListenerHTTPSRedirectPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerListenerHTTPSRedirectPatch.HTTPStatusCode) {
_patch["http_status_code"] = loadBalancerListenerHTTPSRedirectPatch.HTTPStatusCode
}
if !core.IsNil(loadBalancerListenerHTTPSRedirectPatch.Listener) {
_patch["listener"] = loadBalancerListenerHTTPSRedirectPatch.Listener.asPatch()
}
if !core.IsNil(loadBalancerListenerHTTPSRedirectPatch.URI) {
_patch["uri"] = loadBalancerListenerHTTPSRedirectPatch.URI
}
return
}
// LoadBalancerListenerHTTPSRedirectPrototype : LoadBalancerListenerHTTPSRedirectPrototype struct
type LoadBalancerListenerHTTPSRedirectPrototype struct {
// The HTTP status code for this redirect.
HTTPStatusCode *int64 `json:"http_status_code" validate:"required"`
// The target listener.
//
// The target listener must be in this load balancer, and must not be the same as the
// listener in the URL.
Listener LoadBalancerListenerIdentityIntf `json:"listener" validate:"required"`
// The redirect relative target URI.
URI *string `json:"uri,omitempty"`
}
// NewLoadBalancerListenerHTTPSRedirectPrototype : Instantiate LoadBalancerListenerHTTPSRedirectPrototype (Generic Model Constructor)
func (*VpcV1) NewLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode int64, listener LoadBalancerListenerIdentityIntf) (_model *LoadBalancerListenerHTTPSRedirectPrototype, err error) {
_model = &LoadBalancerListenerHTTPSRedirectPrototype{
HTTPStatusCode: core.Int64Ptr(httpStatusCode),
Listener: listener,
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalLoadBalancerListenerHTTPSRedirectPrototype unmarshals an instance of LoadBalancerListenerHTTPSRedirectPrototype from the specified map of raw messages.
func UnmarshalLoadBalancerListenerHTTPSRedirectPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerListenerHTTPSRedirectPrototype)
err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode)
if err != nil {
err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "uri", &obj.URI)
if err != nil {
err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerListenerIdentity : Identifies a load balancer listener by a unique property.
// Models which "extend" this model:
// - LoadBalancerListenerIdentityByID
// - LoadBalancerListenerIdentityByHref
type LoadBalancerListenerIdentity struct {
// The unique identifier for this load balancer listener.
ID *string `json:"id,omitempty"`
// The URL for this load balancer listener.
Href *string `json:"href,omitempty"`
}
func (*LoadBalancerListenerIdentity) isaLoadBalancerListenerIdentity() bool {
return true
}
type LoadBalancerListenerIdentityIntf interface {
isaLoadBalancerListenerIdentity() bool
asPatch() map[string]interface{}
}
// UnmarshalLoadBalancerListenerIdentity unmarshals an instance of LoadBalancerListenerIdentity from the specified map of raw messages.
func UnmarshalLoadBalancerListenerIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerListenerIdentity)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the LoadBalancerListenerIdentity
func (loadBalancerListenerIdentity *LoadBalancerListenerIdentity) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerListenerIdentity.ID) {
_patch["id"] = loadBalancerListenerIdentity.ID
}
if !core.IsNil(loadBalancerListenerIdentity.Href) {
_patch["href"] = loadBalancerListenerIdentity.Href
}
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`). Additional restrictions:
// - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must
// match the `accept_proxy_protocol` value of the `https_redirect` listener.
// - If this listener is the target of another listener's `https_redirect`, its
// `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value.
AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"`
// The certificate instance to use for SSL termination. The listener must have a
// `protocol` of `https`.
CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"`
// The concurrent connection limit for the listener. If reached, incoming connections may be queued or rejected.
//
// Supported for load balancers in the `application` family.
ConnectionLimit *int64 `json:"connection_limit,omitempty"`
// The default pool for this listener. If `https_redirect` is set, the default pool will not
// be used. The specified pool must:
//
// - Belong to this load balancer
// - Have the same `protocol` as this listener, or have a compatible protocol.
// At present, the compatible protocols are `http` and `https`.
// - Not already be the `default_pool` for another listener
//
// Specify `null` to remove an existing default pool.
DefaultPool LoadBalancerListenerDefaultPoolPatchIntf `json:"default_pool,omitempty"`
// The target listener that requests will be redirected to if none of the listener's
// `policies` match.
//
// If specified, this listener must have a `protocol` of `http`, and the target listener
// must have a `protocol` of `https`.
//
// Specify `null` to remove any existing https redirect.
HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPatch `json:"https_redirect,omitempty"`
// The idle connection timeout of the listener in seconds.
//
// Supported for load balancers in the `application` family.
IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"`
// The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. Updating
// `port` updates `port_min` to the same value.
//
// Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to
// `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be
// `1`.
//
// Each listener in the load balancer must have a non-overlapping port range and
// `protocol` combination. Protocol values of `tcp`, `http` and `https` share the TCP port space.
Port *int64 `json:"port,omitempty"`
// The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`.
//
// Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to
// `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be
// `65535`.
//
// The specified port range must not overlap with port ranges used by other listeners for this load balancer using the
// same protocol. Protocol values of `tcp`, `http` and
// `https` share the TCP port space.
PortMax *int64 `json:"port_max,omitempty"`
// The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. Updating
// `port_min` updates `port` to the same value.
//
// Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to
// `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be
// `1`.
//
// Each listener in the load balancer must have a non-overlapping port range and
// `protocol` combination.
PortMin *int64 `json:"port_min,omitempty"`
// The listener protocol. Each listener in the load balancer must have a non-overlapping port range and `protocol`
// combination.
//
// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the
// `application` family support `tcp`, `http` and
// `https`.
//
// Additional restrictions:
// - If `default_pool` is set, the protocol cannot be changed.
// - If `https_redirect` is set, the protocol must be `http`.
// - If another listener's `https_redirect` targets this listener, the protocol must be
// `https`.
Protocol *string `json:"protocol,omitempty"`
}
// Constants associated with the LoadBalancerListenerPatch.Protocol property.
// The listener protocol. Each listener in the load balancer must have a non-overlapping port range and `protocol`
// combination.
//
// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the
// `application` family support `tcp`, `http` and
// `https`.
//
// Additional restrictions:
// - If `default_pool` is set, the protocol cannot be changed.
// - If `https_redirect` is set, the protocol must be `http`.
// - If another listener's `https_redirect` targets this listener, the protocol must be
// `https`.
const (
LoadBalancerListenerPatchProtocolHTTPConst = "http"
LoadBalancerListenerPatchProtocolHTTPSConst = "https"
LoadBalancerListenerPatchProtocolTCPConst = "tcp"
LoadBalancerListenerPatchProtocolUDPConst = "udp"
)
// 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 {
err = core.SDKErrorf(err, "", "accept_proxy_protocol-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "certificate_instance-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit)
if err != nil {
err = core.SDKErrorf(err, "", "connection_limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerListenerDefaultPoolPatch)
if err != nil {
err = core.SDKErrorf(err, "", "default_pool-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirectPatch)
if err != nil {
err = core.SDKErrorf(err, "", "https_redirect-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout)
if err != nil {
err = core.SDKErrorf(err, "", "idle_connection_timeout-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port", &obj.Port)
if err != nil {
err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax)
if err != nil {
err = core.SDKErrorf(err, "", "port_max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin)
if err != nil {
err = core.SDKErrorf(err, "", "port_min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol)
if err != nil {
err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerListenerPatch.AcceptProxyProtocol) {
_patch["accept_proxy_protocol"] = loadBalancerListenerPatch.AcceptProxyProtocol
}
if !core.IsNil(loadBalancerListenerPatch.CertificateInstance) {
_patch["certificate_instance"] = loadBalancerListenerPatch.CertificateInstance.asPatch()
}
if !core.IsNil(loadBalancerListenerPatch.ConnectionLimit) {
_patch["connection_limit"] = loadBalancerListenerPatch.ConnectionLimit
}
if !core.IsNil(loadBalancerListenerPatch.DefaultPool) {
_patch["default_pool"] = loadBalancerListenerPatch.DefaultPool.asPatch()
}
if !core.IsNil(loadBalancerListenerPatch.HTTPSRedirect) {
_patch["https_redirect"] = loadBalancerListenerPatch.HTTPSRedirect.asPatch()
}
if !core.IsNil(loadBalancerListenerPatch.IdleConnectionTimeout) {
_patch["idle_connection_timeout"] = loadBalancerListenerPatch.IdleConnectionTimeout
}
if !core.IsNil(loadBalancerListenerPatch.Port) {
_patch["port"] = loadBalancerListenerPatch.Port
}
if !core.IsNil(loadBalancerListenerPatch.PortMax) {
_patch["port_max"] = loadBalancerListenerPatch.PortMax
}
if !core.IsNil(loadBalancerListenerPatch.PortMin) {
_patch["port_min"] = loadBalancerListenerPatch.PortMin
}
if !core.IsNil(loadBalancerListenerPatch.Protocol) {
_patch["protocol"] = loadBalancerListenerPatch.Protocol
}
return
}
// LoadBalancerListenerPolicy : LoadBalancerListenerPolicy struct
type LoadBalancerListenerPolicy struct {
// The policy action:
// - `forward_to_listener`: Requests will be forwarded to the specified `target`
// listener
// - `forward_to_pool`: Requests will be forwarded to the specified `target` pool
// - `https_redirect`: Requests will be redirected to the specified `target` listener.
// The listener must have a `protocol` of `http`, and the target listener must have a
// `protocol` of `https`
// - `redirect`: Requests will be redirected to the specified `target.url`
// - `reject`: Requests will be rejected with a `403` status code
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Action *string `json:"action" validate:"required"`
// The date and time that this policy was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The URL for this load balancer policy.
Href *string `json:"href" validate:"required"`
// The unique identifier for this load balancer policy.
ID *string `json:"id" validate:"required"`
// The name for this load balancer listener policy. The name is unique across all policies for the load balancer
// listener.
Name *string `json:"name" validate:"required"`
// The priority of the policy. The priority is unique across all policies for this load balancer listener. Lower value
// indicates higher priority.
Priority *int64 `json:"priority" validate:"required"`
// The provisioning status of this policy
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
ProvisioningStatus *string `json:"provisioning_status" validate:"required"`
// The rules for this policy.
Rules []LoadBalancerListenerPolicyRuleReference `json:"rules" validate:"required"`
// - If `action` is `forward_to_listener`, specify a `LoadBalancerListenerIdentity`
// - If `action` is `forward_to_pool`, specify a `LoadBalancerPoolIdentity`
// - If `action` is `https_redirect`, the response is a
// `LoadBalancerListenerPolicyHTTPSRedirect`
// - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL`.
Target LoadBalancerListenerPolicyTargetIntf `json:"target,omitempty"`
}
// Constants associated with the LoadBalancerListenerPolicy.Action property.
// The policy action:
// - `forward_to_listener`: Requests will be forwarded to the specified `target`
// listener
// - `forward_to_pool`: Requests will be forwarded to the specified `target` pool
// - `https_redirect`: Requests will be redirected to the specified `target` listener.
// The listener must have a `protocol` of `http`, and the target listener must have a
// `protocol` of `https`
// - `redirect`: Requests will be redirected to the specified `target.url`
// - `reject`: Requests will be rejected with a `403` status code
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerListenerPolicyActionForwardToListenerConst = "forward_to_listener"
LoadBalancerListenerPolicyActionForwardToPoolConst = "forward_to_pool"
LoadBalancerListenerPolicyActionHTTPSRedirectConst = "https_redirect"
LoadBalancerListenerPolicyActionRedirectConst = "redirect"
LoadBalancerListenerPolicyActionRejectConst = "reject"
)
// Constants associated with the LoadBalancerListenerPolicy.ProvisioningStatus property.
// The provisioning status of this policy
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerListenerPolicyProvisioningStatusActiveConst = "active"
LoadBalancerListenerPolicyProvisioningStatusCreatePendingConst = "create_pending"
LoadBalancerListenerPolicyProvisioningStatusDeletePendingConst = "delete_pending"
LoadBalancerListenerPolicyProvisioningStatusFailedConst = "failed"
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 {
err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "priority", &obj.Priority)
if err != nil {
err = core.SDKErrorf(err, "", "priority-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus)
if err != nil {
err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRuleReference)
if err != nil {
err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTarget)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerListenerPolicyCollection : LoadBalancerListenerPolicyCollection struct
type LoadBalancerListenerPolicyCollection struct {
// The policies for the load balancer listener.
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 {
err = core.SDKErrorf(err, "", "policies-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerListenerPolicyPatch : LoadBalancerListenerPolicyPatch struct
type LoadBalancerListenerPolicyPatch struct {
// The name for this policy. The name must not be used by another policy for the load balancer listener.
Name *string `json:"name,omitempty"`
// The priority of the policy. The priority is unique across all policies for this load balancer listener. Lower value
// indicates higher priority.
Priority *int64 `json:"priority,omitempty"`
// - If `action` is `forward_to_listener`, specify a `LoadBalancerListenerIdentity` for a
// listener in this load balancer.
// - If `action` is `forward_to_pool`, specify a `LoadBalancerPoolIdentity` for a pool in
// this load balancer.
// - If `action` is `https_redirect`, specify a
// `LoadBalancerListenerPolicyHTTPSRedirectPatch` for a listener in this load balancer
// with a `protocol` of `https`.
// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`.
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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "priority", &obj.Priority)
if err != nil {
err = core.SDKErrorf(err, "", "priority-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPatch)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerListenerPolicyPatch.Name) {
_patch["name"] = loadBalancerListenerPolicyPatch.Name
}
if !core.IsNil(loadBalancerListenerPolicyPatch.Priority) {
_patch["priority"] = loadBalancerListenerPolicyPatch.Priority
}
if !core.IsNil(loadBalancerListenerPolicyPatch.Target) {
_patch["target"] = loadBalancerListenerPolicyPatch.Target.asPatch()
}
return
}
// LoadBalancerListenerPolicyPrototype : LoadBalancerListenerPolicyPrototype struct
type LoadBalancerListenerPolicyPrototype struct {
// The policy action:
// - `forward_to_listener`: Requests will be forwarded to the specified
// `target` listener.
// - `forward_to_pool`: Requests will be forwarded to the specified `target` pool.
// - `https_redirect`: Requests will be redirected to the specified `target.listener`.
// This listener must have a `protocol` of `http`, and the target listener must
// have a `protocol` of `https`.
// - `redirect`: Requests will be redirected to the specified `target.url`
// - `reject`: Requests will be rejected with a `403` status code.
Action *string `json:"action" validate:"required"`
// The name for this policy. The name must not be used by another policy for the load balancer listener. If
// unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The priority of the policy. The priority is unique across all policies for this load balancer listener. Lower value
// indicates higher priority.
Priority *int64 `json:"priority" validate:"required"`
// The rule prototype objects for this policy.
Rules []LoadBalancerListenerPolicyRulePrototype `json:"rules,omitempty"`
// - If `action` is `forward_to_listener`, specify a `LoadBalancerListenerIdentity` in this
// load balancer to forward to.
// - If `action` is `forward_to_pool`, use `LoadBalancerPoolIdentity` to specify a pool in
// this load balancer to forward to.
// - If `action` is `https_redirect`, use
// `LoadBalancerListenerPolicyHTTPSRedirectPrototype` to specify a listener on this
// load balancer to redirect to.
// - If `action` is `redirect`, use `LoadBalancerListenerPolicyRedirectURLPrototype`to
// specify a URL to redirect to.
Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"`
}
// Constants associated with the LoadBalancerListenerPolicyPrototype.Action property.
// The policy action:
// - `forward_to_listener`: Requests will be forwarded to the specified
// `target` listener.
// - `forward_to_pool`: Requests will be forwarded to the specified `target` pool.
// - `https_redirect`: Requests will be redirected to the specified `target.listener`.
// This listener must have a `protocol` of `http`, and the target listener must
// have a `protocol` of `https`.
// - `redirect`: Requests will be redirected to the specified `target.url`
// - `reject`: Requests will be rejected with a `403` status code.
const (
LoadBalancerListenerPolicyPrototypeActionForwardToListenerConst = "forward_to_listener"
LoadBalancerListenerPolicyPrototypeActionForwardToPoolConst = "forward_to_pool"
LoadBalancerListenerPolicyPrototypeActionHTTPSRedirectConst = "https_redirect"
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")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
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 {
err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "priority", &obj.Priority)
if err != nil {
err = core.SDKErrorf(err, "", "priority-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRulePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
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 *Deleted `json:"deleted,omitempty"`
// The URL for this load balancer policy.
Href *string `json:"href" validate:"required"`
// The unique identifier for this load balancer policy.
ID *string `json:"id" validate:"required"`
// The name for this load balancer listener policy. The name is unique across all policies for the load balancer
// listener.
Name *string `json:"name" 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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerListenerPolicyRule : LoadBalancerListenerPolicyRule struct
type LoadBalancerListenerPolicyRule struct {
// The condition for the rule.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 to match for this rule. If `condition` is not `matches_regex`, the value is percent-encoded.
Field *string `json:"field,omitempty"`
// The URL for this load balancer listener policy rule.
Href *string `json:"href" validate:"required"`
// The unique identifier for this load balancer listener policy rule.
ID *string `json:"id" validate:"required"`
// The provisioning status of this rule
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Type *string `json:"type" validate:"required"`
// The value to be matched for the 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 for the rule.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerListenerPolicyRuleConditionContainsConst = "contains"
LoadBalancerListenerPolicyRuleConditionEqualsConst = "equals"
LoadBalancerListenerPolicyRuleConditionMatchesRegexConst = "matches_regex"
)
// Constants associated with the LoadBalancerListenerPolicyRule.ProvisioningStatus property.
// The provisioning status of this rule
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerListenerPolicyRuleProvisioningStatusActiveConst = "active"
LoadBalancerListenerPolicyRuleProvisioningStatusCreatePendingConst = "create_pending"
LoadBalancerListenerPolicyRuleProvisioningStatusDeletePendingConst = "delete_pending"
LoadBalancerListenerPolicyRuleProvisioningStatusFailedConst = "failed"
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.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerListenerPolicyRuleTypeBodyConst = "body"
LoadBalancerListenerPolicyRuleTypeHeaderConst = "header"
LoadBalancerListenerPolicyRuleTypeHostnameConst = "hostname"
LoadBalancerListenerPolicyRuleTypePathConst = "path"
LoadBalancerListenerPolicyRuleTypeQueryConst = "query"
LoadBalancerListenerPolicyRuleTypeSniHostnameConst = "sni_hostname"
)
// 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 {
err = core.SDKErrorf(err, "", "condition-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "field", &obj.Field)
if err != nil {
err = core.SDKErrorf(err, "", "field-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus)
if err != nil {
err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerListenerPolicyRuleCollection : LoadBalancerListenerPolicyRuleCollection struct
type LoadBalancerListenerPolicyRuleCollection struct {
// The rules for the load balancer listener policy.
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 {
err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerListenerPolicyRulePatch : LoadBalancerListenerPolicyRulePatch struct
type LoadBalancerListenerPolicyRulePatch struct {
// The condition for the rule.
Condition *string `json:"condition,omitempty"`
// The field to match for this rule.
// - If the `type` is `header`, this property must be specified.
// - If the `type` is `body` or `query`, this property may be specified.
// - For all other types, this property must not be specified.
Field *string `json:"field,omitempty"`
// The content the rule applies to:
// - `body`: The UTF-8 form-encoded HTTP request body
// - `header`: The HTTP header
// - `hostname`: The fully-qualified domain name of the server specified in the Host
// HTTP request header
// - `path`: The path of the HTTP request
// - `query`: The query of the HTTP request URL
// - `sni_hostname`: The fully-qualified domain name of the server provided in the
// "server name indicator" extension during TLS negotiation
//
// - For listeners with `protocol` `http` or `https`, any type may be specified.
// - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified.
Type *string `json:"type,omitempty"`
// The value to be matched for the 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 for the rule.
const (
LoadBalancerListenerPolicyRulePatchConditionContainsConst = "contains"
LoadBalancerListenerPolicyRulePatchConditionEqualsConst = "equals"
LoadBalancerListenerPolicyRulePatchConditionMatchesRegexConst = "matches_regex"
)
// Constants associated with the LoadBalancerListenerPolicyRulePatch.Type property.
// The content the rule applies to:
// - `body`: The UTF-8 form-encoded HTTP request body
// - `header`: The HTTP header
// - `hostname`: The fully-qualified domain name of the server specified in the Host
// HTTP request header
// - `path`: The path of the HTTP request
// - `query`: The query of the HTTP request URL
// - `sni_hostname`: The fully-qualified domain name of the server provided in the
// "server name indicator" extension during TLS negotiation
//
// - For listeners with `protocol` `http` or `https`, any type may be specified.
// - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified.
const (
LoadBalancerListenerPolicyRulePatchTypeBodyConst = "body"
LoadBalancerListenerPolicyRulePatchTypeHeaderConst = "header"
LoadBalancerListenerPolicyRulePatchTypeHostnameConst = "hostname"
LoadBalancerListenerPolicyRulePatchTypePathConst = "path"
LoadBalancerListenerPolicyRulePatchTypeQueryConst = "query"
LoadBalancerListenerPolicyRulePatchTypeSniHostnameConst = "sni_hostname"
)
// 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 {
err = core.SDKErrorf(err, "", "condition-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "field", &obj.Field)
if err != nil {
err = core.SDKErrorf(err, "", "field-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerListenerPolicyRulePatch.Condition) {
_patch["condition"] = loadBalancerListenerPolicyRulePatch.Condition
}
if !core.IsNil(loadBalancerListenerPolicyRulePatch.Field) {
_patch["field"] = loadBalancerListenerPolicyRulePatch.Field
}
if !core.IsNil(loadBalancerListenerPolicyRulePatch.Type) {
_patch["type"] = loadBalancerListenerPolicyRulePatch.Type
}
if !core.IsNil(loadBalancerListenerPolicyRulePatch.Value) {
_patch["value"] = loadBalancerListenerPolicyRulePatch.Value
}
return
}
// LoadBalancerListenerPolicyRulePrototype : LoadBalancerListenerPolicyRulePrototype struct
type LoadBalancerListenerPolicyRulePrototype struct {
// The condition for the rule.
Condition *string `json:"condition" validate:"required"`
// The field to match for this rule.
// - If the `type` is `header`, this property must be specified.
// - If the `type` is `body` or `query`, this property may be specified.
// - For all other types, this property must not be specified.
Field *string `json:"field,omitempty"`
// The content the rule applies to:
// - `body`: The UTF-8 form-encoded HTTP request body
// - `header`: The HTTP header
// - `hostname`: The fully-qualified domain name of the server specified in the Host
// HTTP request header
// - `path`: The path of the HTTP request
// - `query`: The query of the HTTP request URL
// - `sni_hostname`: The fully-qualified domain name of the server provided in the
// "server name indicator" extension during TLS negotiation
//
// - For listeners with `protocol` `http` or `https`, any type may be specified.
// - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified.
Type *string `json:"type" validate:"required"`
// The value to be matched for the 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 for the rule.
const (
LoadBalancerListenerPolicyRulePrototypeConditionContainsConst = "contains"
LoadBalancerListenerPolicyRulePrototypeConditionEqualsConst = "equals"
LoadBalancerListenerPolicyRulePrototypeConditionMatchesRegexConst = "matches_regex"
)
// Constants associated with the LoadBalancerListenerPolicyRulePrototype.Type property.
// The content the rule applies to:
// - `body`: The UTF-8 form-encoded HTTP request body
// - `header`: The HTTP header
// - `hostname`: The fully-qualified domain name of the server specified in the Host
// HTTP request header
// - `path`: The path of the HTTP request
// - `query`: The query of the HTTP request URL
// - `sni_hostname`: The fully-qualified domain name of the server provided in the
// "server name indicator" extension during TLS negotiation
//
// - For listeners with `protocol` `http` or `https`, any type may be specified.
// - For listeners with `protocol` `tcp`, only type `sni_hostname` may be specified.
const (
LoadBalancerListenerPolicyRulePrototypeTypeBodyConst = "body"
LoadBalancerListenerPolicyRulePrototypeTypeHeaderConst = "header"
LoadBalancerListenerPolicyRulePrototypeTypeHostnameConst = "hostname"
LoadBalancerListenerPolicyRulePrototypeTypePathConst = "path"
LoadBalancerListenerPolicyRulePrototypeTypeQueryConst = "query"
LoadBalancerListenerPolicyRulePrototypeTypeSniHostnameConst = "sni_hostname"
)
// 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")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
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 {
err = core.SDKErrorf(err, "", "condition-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "field", &obj.Field)
if err != nil {
err = core.SDKErrorf(err, "", "field-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
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 *Deleted `json:"deleted,omitempty"`
// The URL for this load balancer listener policy rule.
Href *string `json:"href" validate:"required"`
// The unique identifier for this load balancer listener policy rule.
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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerListenerPolicyTarget : - If `action` is `forward_to_listener`, specify a `LoadBalancerListenerIdentity`
// - If `action` is `forward_to_pool`, specify a `LoadBalancerPoolIdentity`
// - If `action` is `https_redirect`, the response is a
// `LoadBalancerListenerPolicyHTTPSRedirect`
// - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL`.
// Models which "extend" this model:
// - LoadBalancerListenerPolicyTargetLoadBalancerPoolReference
// - LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect
// - LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL
// - LoadBalancerListenerPolicyTargetLoadBalancerListenerReference
type LoadBalancerListenerPolicyTarget struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this load balancer pool.
Href *string `json:"href,omitempty"`
// The unique identifier for this load balancer pool.
ID *string `json:"id,omitempty"`
// The name for this load balancer pool. The name is unique across all pools for the load balancer.
Name *string `json:"name,omitempty"`
// The HTTP status code for this redirect.
HTTPStatusCode *int64 `json:"http_status_code,omitempty"`
Listener *LoadBalancerListenerReference `json:"listener,omitempty"`
// The redirect relative target URI.
URI *string `json:"uri,omitempty"`
// The redirect target URL. The URL supports [RFC 6570 level 1
// expressions](https://datatracker.ietf.org/doc/html/rfc6570#section-1.2) for the following variables which expand to
// values from the originally requested URL (or the indicated defaults if the request did not include them):
//
// - `protocol`
// - `host`
// - `port` (default: `80` for HTTP requests, `443` for HTTPS requests)
// - `path` (default: '/')
// - `query` (default: '')
//
// The protocol, host, and port segments of the URL, must only contain at most one instance of the `protocol`, `host`,
// and `port` variables, respectively. The path and query segments of the URL may contain any combination of variables.
// If the substitution of `path` results in consecutive leading slashes, the leading slash from the substitution will
// be removed. Additional examples:
// - `https://{host}:8080/{port}/{host}/{path}`
// - `https://www.example.com`
// - `{protocol}://test.{host}:80/{path}`.
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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode)
if err != nil {
err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference)
if err != nil {
err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "uri", &obj.URI)
if err != nil {
err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "url", &obj.URL)
if err != nil {
err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerListenerPolicyTargetPatch : - If `action` is `forward_to_listener`, specify a `LoadBalancerListenerIdentity` for a
//
// listener in this load balancer.
// - If `action` is `forward_to_pool`, specify a `LoadBalancerPoolIdentity` for a pool in
// this load balancer.
// - If `action` is `https_redirect`, specify a
// `LoadBalancerListenerPolicyHTTPSRedirectPatch` for a listener in this load balancer
// with a `protocol` of `https`.
// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`.
//
// Models which "extend" this model:
// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity
// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch
// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch
// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerIdentity
type LoadBalancerListenerPolicyTargetPatch struct {
// The unique identifier for this load balancer pool.
ID *string `json:"id,omitempty"`
// The URL for this load balancer pool.
Href *string `json:"href,omitempty"`
// The HTTP status code for this redirect.
HTTPStatusCode *int64 `json:"http_status_code,omitempty"`
// The target listener.
//
// The target listener must be in this load balancer, and must not be the same as the
// listener in the URL.
Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"`
// The redirect relative target URI.
URI *string `json:"uri,omitempty"`
// The redirect target URL. The URL supports [RFC 6570 level 1
// expressions](https://datatracker.ietf.org/doc/html/rfc6570#section-1.2) for the following variables which expand to
// values from the originally requested URL (or the indicated defaults if the request did not include them):
//
// - `protocol`
// - `host`
// - `port` (default: `80` for HTTP requests, `443` for HTTPS requests)
// - `path` (default: '/')
// - `query` (default: '')
//
// The protocol, host, and port segments of the URL, must only contain at most one instance of the `protocol`, `host`,
// and `port` variables, respectively. The path and query segments of the URL may contain any combination of variables.
// If the substitution of `path` results in consecutive leading slashes, the leading slash from the substitution will
// be removed. Additional examples:
// - `https://{host}:8080/{port}/{host}/{path}`
// - `https://www.example.com`
// - `{protocol}://test.{host}:80/{path}`.
URL *string `json:"url,omitempty"`
}
func (*LoadBalancerListenerPolicyTargetPatch) isaLoadBalancerListenerPolicyTargetPatch() bool {
return true
}
type LoadBalancerListenerPolicyTargetPatchIntf interface {
isaLoadBalancerListenerPolicyTargetPatch() bool
asPatch() map[string]interface{}
}
// 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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode)
if err != nil {
err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "uri", &obj.URI)
if err != nil {
err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "url", &obj.URL)
if err != nil {
err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the LoadBalancerListenerPolicyTargetPatch
func (loadBalancerListenerPolicyTargetPatch *LoadBalancerListenerPolicyTargetPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerListenerPolicyTargetPatch.ID) {
_patch["id"] = loadBalancerListenerPolicyTargetPatch.ID
}
if !core.IsNil(loadBalancerListenerPolicyTargetPatch.Href) {
_patch["href"] = loadBalancerListenerPolicyTargetPatch.Href
}
if !core.IsNil(loadBalancerListenerPolicyTargetPatch.HTTPStatusCode) {
_patch["http_status_code"] = loadBalancerListenerPolicyTargetPatch.HTTPStatusCode
}
if !core.IsNil(loadBalancerListenerPolicyTargetPatch.Listener) {
_patch["listener"] = loadBalancerListenerPolicyTargetPatch.Listener.asPatch()
}
if !core.IsNil(loadBalancerListenerPolicyTargetPatch.URI) {
_patch["uri"] = loadBalancerListenerPolicyTargetPatch.URI
}
if !core.IsNil(loadBalancerListenerPolicyTargetPatch.URL) {
_patch["url"] = loadBalancerListenerPolicyTargetPatch.URL
}
return
}
// LoadBalancerListenerPolicyTargetPrototype : - If `action` is `forward_to_listener`, specify a `LoadBalancerListenerIdentity` in this
//
// load balancer to forward to.
// - If `action` is `forward_to_pool`, use `LoadBalancerPoolIdentity` to specify a pool in
// this load balancer to forward to.
// - If `action` is `https_redirect`, use
// `LoadBalancerListenerPolicyHTTPSRedirectPrototype` to specify a listener on this
// load balancer to redirect to.
// - If `action` is `redirect`, use `LoadBalancerListenerPolicyRedirectURLPrototype`to
// specify a URL to redirect to.
//
// Models which "extend" this model:
// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity
// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerIdentity
// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype
// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype
type LoadBalancerListenerPolicyTargetPrototype struct {
// The unique identifier for this load balancer pool.
ID *string `json:"id,omitempty"`
// The URL for this load balancer pool.
Href *string `json:"href,omitempty"`
// The HTTP status code for this redirect.
HTTPStatusCode *int64 `json:"http_status_code,omitempty"`
// The target listener.
//
// The target listener must be in this load balancer, and must not be the same as the
// listener in the URL.
Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"`
// The redirect relative target URI.
URI *string `json:"uri,omitempty"`
// The redirect target URL. The URL supports [RFC 6570 level 1
// expressions](https://datatracker.ietf.org/doc/html/rfc6570#section-1.2) for the following variables which expand to
// values from the originally requested URL (or the indicated defaults if the request did not include them):
//
// - `protocol`
// - `host`
// - `port` (default: `80` for HTTP requests, `443` for HTTPS requests)
// - `path` (default: '/')
// - `query` (default: '')
//
// The protocol, host, and port segments of the URL, must only contain at most one instance of the `protocol`, `host`,
// and `port` variables, respectively. The path and query segments of the URL may contain any combination of variables.
// If the substitution of `path` results in consecutive leading slashes, the leading slash from the substitution will
// be removed. Additional examples:
// - `https://{host}:8080/{port}/{host}/{path}`
// - `https://www.example.com`
// - `{protocol}://test.{host}:80/{path}`.
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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode)
if err != nil {
err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "uri", &obj.URI)
if err != nil {
err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "url", &obj.URL)
if err != nil {
err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo())
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`). Additional restrictions:
// - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must
// match the `accept_proxy_protocol` value of the `https_redirect` listener.
// - If this listener is the target of another listener's `https_redirect`, its
// `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value.
AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"`
// The certificate instance to use for SSL termination. The listener must have a
// `protocol` of `https`.
CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"`
// The concurrent connection limit for the listener. If reached, incoming connections may be queued or rejected.
//
// Supported for load balancers in the `application` family.
//
// If unspecified, the limit will be `15000` for load balancers in the `application` family.
ConnectionLimit *int64 `json:"connection_limit,omitempty"`
// The default pool for this listener. If `https_redirect` is specified,
// the default pool will not be used. If specified, the pool must:
//
// - Belong to this load balancer.
// - Have the same `protocol` as this listener, or have a compatible protocol.
// At present, the compatible protocols are `http` and `https`.
// - Not already be the `default_pool` for another listener.
//
// If unspecified, this listener will be created with no default pool, but one may be
// subsequently set.
DefaultPool *LoadBalancerPoolIdentityByName `json:"default_pool,omitempty"`
// The target listener that requests will be redirected to if none of the listener's
// `policies` match.
//
// If specified, this listener must have a `protocol` of `http`, and the target
// listener must have a `protocol` of `https`.
HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPrototype `json:"https_redirect,omitempty"`
// The idle connection timeout of the listener in seconds.
//
// Supported for load balancers in the `application` family.
//
// If unspecified, the timeout will be `50` for load balancers in the `application` family.
IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"`
// The listener port number. Each listener in the load balancer must have a non-overlapping port range and `protocol`
// combination. Protocol values of `tcp`, `http` and `https` share the TCP port space.
//
// If `port_min` is also specified, `port` must have the same value as `port_min`.
Port *int64 `json:"port,omitempty"`
// The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`.
//
// Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to
// `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be
// `65535`.
//
// The specified port range must not overlap with port ranges used by other listeners for this load balancer using the
// same protocol. Protocol values of `tcp`, `http` and
// `https` share the TCP port space.
PortMax *int64 `json:"port_max,omitempty"`
// The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`.
//
// If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be
// unspecified.
//
// If `port` is also specified, `port_min` must have the same value as `port`.
//
// Only network load balancers with `route_mode`, `is_public` or `is_private_path` set to
// `true` support different values for `port_min` and `port_max`. If `route_mode` is set to `true`, the value must be
// `1`.
//
// The specified port range must not overlap with port ranges used by other listeners for this load balancer using the
// same protocol. Protocol values of `tcp`, `http` and
// `https` share the TCP port space.
PortMin *int64 `json:"port_min,omitempty"`
// The listener protocol. Each listener in the load balancer must have a non-overlapping port range and `protocol`
// combination.
//
// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the
// `application` family support `tcp`, `http` and
// `https`.
//
// Additional restrictions:
// - If `default_pool` is set, the pool's protocol must match, or be compatible with
// the listener's protocol. At present, the compatible protocols are `http` and
// `https`.
// - If `https_redirect` is set, the protocol must be `http`.
Protocol *string `json:"protocol" validate:"required"`
}
// Constants associated with the LoadBalancerListenerPrototypeLoadBalancerContext.Protocol property.
// The listener protocol. Each listener in the load balancer must have a non-overlapping port range and `protocol`
// combination.
//
// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the
// `application` family support `tcp`, `http` and
// `https`.
//
// Additional restrictions:
// - If `default_pool` is set, the pool's protocol must match, or be compatible with
// the listener's protocol. At present, the compatible protocols are `http` and
// `https`.
// - If `https_redirect` is set, the protocol must be `http`.
const (
LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPConst = "http"
LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPSConst = "https"
LoadBalancerListenerPrototypeLoadBalancerContextProtocolTCPConst = "tcp"
LoadBalancerListenerPrototypeLoadBalancerContextProtocolUDPConst = "udp"
)
// NewLoadBalancerListenerPrototypeLoadBalancerContext : Instantiate LoadBalancerListenerPrototypeLoadBalancerContext (Generic Model Constructor)
func (*VpcV1) NewLoadBalancerListenerPrototypeLoadBalancerContext(protocol string) (_model *LoadBalancerListenerPrototypeLoadBalancerContext, err error) {
_model = &LoadBalancerListenerPrototypeLoadBalancerContext{
Protocol: core.StringPtr(protocol),
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
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 {
err = core.SDKErrorf(err, "", "accept_proxy_protocol-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "certificate_instance-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit)
if err != nil {
err = core.SDKErrorf(err, "", "connection_limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolIdentityByName)
if err != nil {
err = core.SDKErrorf(err, "", "default_pool-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirectPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "https_redirect-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout)
if err != nil {
err = core.SDKErrorf(err, "", "idle_connection_timeout-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port", &obj.Port)
if err != nil {
err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax)
if err != nil {
err = core.SDKErrorf(err, "", "port_max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin)
if err != nil {
err = core.SDKErrorf(err, "", "port_min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol)
if err != nil {
err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo())
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 *Deleted `json:"deleted,omitempty"`
// The URL for this load balancer listener.
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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerLogging : LoadBalancerLogging struct
type LoadBalancerLogging struct {
// The datapath logging configuration for this load balancer.
Datapath *LoadBalancerLoggingDatapath `json:"datapath" validate:"required"`
}
// 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 {
err = core.SDKErrorf(err, "", "datapath-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerLoggingDatapath : The datapath logging configuration for this load balancer.
type LoadBalancerLoggingDatapath struct {
// Indicates whether datapath logging is active for this load balancer.
Active *bool `json:"active" validate:"required"`
}
// 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 {
err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerLoggingDatapathPatch : The datapath logging configuration for this load balancer.
type LoadBalancerLoggingDatapathPatch struct {
// Indicates whether datapath logging will be active for this load balancer.
Active *bool `json:"active,omitempty"`
}
// UnmarshalLoadBalancerLoggingDatapathPatch unmarshals an instance of LoadBalancerLoggingDatapathPatch from the specified map of raw messages.
func UnmarshalLoadBalancerLoggingDatapathPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerLoggingDatapathPatch)
err = core.UnmarshalPrimitive(m, "active", &obj.Active)
if err != nil {
err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the LoadBalancerLoggingDatapathPatch
func (loadBalancerLoggingDatapathPatch *LoadBalancerLoggingDatapathPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerLoggingDatapathPatch.Active) {
_patch["active"] = loadBalancerLoggingDatapathPatch.Active
}
return
}
// LoadBalancerLoggingDatapathPrototype : The datapath logging configuration for this load balancer.
type LoadBalancerLoggingDatapathPrototype struct {
// Indicates whether datapath logging will be active for this load balancer.
Active *bool `json:"active,omitempty"`
}
// UnmarshalLoadBalancerLoggingDatapathPrototype unmarshals an instance of LoadBalancerLoggingDatapathPrototype from the specified map of raw messages.
func UnmarshalLoadBalancerLoggingDatapathPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerLoggingDatapathPrototype)
err = core.UnmarshalPrimitive(m, "active", &obj.Active)
if err != nil {
err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerLoggingPatch : LoadBalancerLoggingPatch struct
type LoadBalancerLoggingPatch struct {
// The datapath logging configuration for this load balancer.
Datapath *LoadBalancerLoggingDatapathPatch `json:"datapath,omitempty"`
}
// UnmarshalLoadBalancerLoggingPatch unmarshals an instance of LoadBalancerLoggingPatch from the specified map of raw messages.
func UnmarshalLoadBalancerLoggingPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerLoggingPatch)
err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapathPatch)
if err != nil {
err = core.SDKErrorf(err, "", "datapath-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the LoadBalancerLoggingPatch
func (loadBalancerLoggingPatch *LoadBalancerLoggingPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerLoggingPatch.Datapath) {
_patch["datapath"] = loadBalancerLoggingPatch.Datapath.asPatch()
}
return
}
// LoadBalancerLoggingPrototype : LoadBalancerLoggingPrototype struct
type LoadBalancerLoggingPrototype struct {
// The datapath logging configuration for this load balancer.
Datapath *LoadBalancerLoggingDatapathPrototype `json:"datapath,omitempty"`
}
// UnmarshalLoadBalancerLoggingPrototype unmarshals an instance of LoadBalancerLoggingPrototype from the specified map of raw messages.
func UnmarshalLoadBalancerLoggingPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerLoggingPrototype)
err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapathPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "datapath-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerPatch : LoadBalancerPatch struct
type LoadBalancerPatch struct {
// The DNS configuration for this load balancer.
//
// Specify `null` to remove the existing DNS configuration, which will remove all DNS `A`
// records for this load balancer that had been added to `zone`, and add equivalent `A`
// records to the public DNS zone `lb.appdomain.cloud`.
//
// Not supported by private path load balancers.
Dns *LoadBalancerDnsPatch `json:"dns,omitempty"`
// The logging configuration to use for this load balancer.
//
// To activate logging, the load balancer profile must support the specified logging type.
Logging *LoadBalancerLoggingPatch `json:"logging,omitempty"`
// The name for this load balancer. The name must not be used by another load balancer in the VPC.
Name *string `json:"name,omitempty"`
// The subnets to provision this load balancer in. The load balancer's availability will depend on the availability of
// the zones that the subnets reside in.
//
// The specified subnets must be in the same VPC as the existing subnets, and will completely replace the existing
// subnets.
//
// The load balancer must be in the `application` family.
Subnets []SubnetIdentityIntf `json:"subnets,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, "dns", &obj.Dns, UnmarshalLoadBalancerDnsPatch)
if err != nil {
err = core.SDKErrorf(err, "", "dns-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLoggingPatch)
if err != nil {
err = core.SDKErrorf(err, "", "logging-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerPatch.Dns) {
_patch["dns"] = loadBalancerPatch.Dns.asPatch()
}
if !core.IsNil(loadBalancerPatch.Logging) {
_patch["logging"] = loadBalancerPatch.Logging.asPatch()
}
if !core.IsNil(loadBalancerPatch.Name) {
_patch["name"] = loadBalancerPatch.Name
}
if !core.IsNil(loadBalancerPatch.Subnets) {
var subnetsPatches []map[string]interface{}
for _, subnets := range loadBalancerPatch.Subnets {
subnetsPatches = append(subnetsPatches, subnets.asPatch())
}
_patch["subnets"] = subnetsPatches
}
return
}
// LoadBalancerPool : LoadBalancerPool struct
type LoadBalancerPool struct {
// The load balancing algorithm.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Algorithm *string `json:"algorithm" validate:"required"`
// The date and time that this pool was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
FailsafePolicy *LoadBalancerPoolFailsafePolicy `json:"failsafe_policy" validate:"required"`
// The health monitor of this pool.
//
// If this pool has a member targeting a load balancer then:
//
// - If the targeted load balancer has multiple subnets, this health monitor is used to
// direct traffic to the available subnets.
// - The health checks spawned by this health monitor is handled as any other traffic
// (that is, subject to the configuration of listeners and pools on the target load
// balancer).
// - This health monitor does not affect how pool member health is determined within the
// target load balancer.
//
// For more information, see [Private Path network load balancer frequently asked
// questions](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-faqs#ppnlb-faqs).
HealthMonitor LoadBalancerPoolHealthMonitorIntf `json:"health_monitor" validate:"required"`
// The URL for this load balancer pool.
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 name for this load balancer pool. The name is unique across all pools for the load balancer.
Name *string `json:"name" validate:"required"`
// The protocol for this load balancer pool.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Protocol *string `json:"protocol" validate:"required"`
// The provisioning status of this pool
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
ProxyProtocol *string `json:"proxy_protocol" validate:"required"`
// The session persistence of this pool.
//
// If absent, session persistence will be disabled, and traffic will be distributed
// across backend server members of the pool.
SessionPersistence *LoadBalancerPoolSessionPersistence `json:"session_persistence,omitempty"`
}
// Constants associated with the LoadBalancerPool.Algorithm property.
// The load balancing algorithm.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerPoolAlgorithmLeastConnectionsConst = "least_connections"
LoadBalancerPoolAlgorithmRoundRobinConst = "round_robin"
LoadBalancerPoolAlgorithmWeightedRoundRobinConst = "weighted_round_robin"
)
// Constants associated with the LoadBalancerPool.Protocol property.
// The protocol for this load balancer pool.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerPoolProtocolHTTPConst = "http"
LoadBalancerPoolProtocolHTTPSConst = "https"
LoadBalancerPoolProtocolTCPConst = "tcp"
LoadBalancerPoolProtocolUDPConst = "udp"
)
// Constants associated with the LoadBalancerPool.ProvisioningStatus property.
// The provisioning status of this pool
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerPoolProvisioningStatusActiveConst = "active"
LoadBalancerPoolProvisioningStatusCreatePendingConst = "create_pending"
LoadBalancerPoolProvisioningStatusDeletePendingConst = "delete_pending"
LoadBalancerPoolProvisioningStatusFailedConst = "failed"
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
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 {
err = core.SDKErrorf(err, "", "algorithm-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "failsafe_policy", &obj.FailsafePolicy, UnmarshalLoadBalancerPoolFailsafePolicy)
if err != nil {
err = core.SDKErrorf(err, "", "failsafe_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitor)
if err != nil {
err = core.SDKErrorf(err, "", "health_monitor-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "instance_group", &obj.InstanceGroup, UnmarshalInstanceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "instance_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberReference)
if err != nil {
err = core.SDKErrorf(err, "", "members-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol)
if err != nil {
err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus)
if err != nil {
err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol)
if err != nil {
err = core.SDKErrorf(err, "", "proxy_protocol-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistence)
if err != nil {
err = core.SDKErrorf(err, "", "session_persistence-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerPoolCollection : LoadBalancerPoolCollection struct
type LoadBalancerPoolCollection struct {
// The pools for the load balancer.
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 {
err = core.SDKErrorf(err, "", "pools-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerPoolFailsafePolicy : LoadBalancerPoolFailsafePolicy struct
type LoadBalancerPoolFailsafePolicy struct {
// A load balancer failsafe policy action:
// - `bypass`: Bypasses the members and sends requests directly to their destination IPs.
// - `drop`: Drops requests.
// - `fail`: Fails requests with an HTTP `503` status code.
// - `forward`: Forwards requests to the `target` pool.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Action *string `json:"action" validate:"required"`
// The healthy member count at which the failsafe policy action will be triggered. At present, this is always `0`, but
// may be modifiable in the future.
HealthyMemberThresholdCount *int64 `json:"healthy_member_threshold_count" validate:"required"`
// If `action` is `forward`, the target pool to forward to.
//
// If `action` is not `forward`, this property will be absent.
//
// The targets supported by this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Target *LoadBalancerPoolReference `json:"target,omitempty"`
}
// Constants associated with the LoadBalancerPoolFailsafePolicy.Action property.
// A load balancer failsafe policy action:
// - `bypass`: Bypasses the members and sends requests directly to their destination IPs.
// - `drop`: Drops requests.
// - `fail`: Fails requests with an HTTP `503` status code.
// - `forward`: Forwards requests to the `target` pool.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerPoolFailsafePolicyActionBypassConst = "bypass"
LoadBalancerPoolFailsafePolicyActionDropConst = "drop"
LoadBalancerPoolFailsafePolicyActionFailConst = "fail"
LoadBalancerPoolFailsafePolicyActionForwardConst = "forward"
)
// UnmarshalLoadBalancerPoolFailsafePolicy unmarshals an instance of LoadBalancerPoolFailsafePolicy from the specified map of raw messages.
func UnmarshalLoadBalancerPoolFailsafePolicy(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerPoolFailsafePolicy)
err = core.UnmarshalPrimitive(m, "action", &obj.Action)
if err != nil {
err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "healthy_member_threshold_count", &obj.HealthyMemberThresholdCount)
if err != nil {
err = core.SDKErrorf(err, "", "healthy_member_threshold_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolReference)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerPoolFailsafePolicyPatch : The failsafe policy for this load balancer pool.
type LoadBalancerPoolFailsafePolicyPatch struct {
// A load balancer failsafe policy action:
// - `bypass`: Bypasses the members and sends requests directly to their destination IPs. If specified, this load
// balancer must have `route_mode` enabled.
// - `drop`: Drops requests. If specified, the pool protocol must be `tcp`.
// - `fail`: Fails requests with an HTTP `503` status code. If specified, the pool protocol must be `http` or `https`.
// - `forward`: Forwards requests to the `target` pool. If specified, the pool protocol must be `http` or `https`.
//
// The specified value must be listed in the `failsafe_policy_actions` for this pool's load balancer.
Action *string `json:"action,omitempty"`
// The failsafe target pool to forward to.
//
// The specified pool must:
// - Belong to this load balancer
// - Have the same `protocol` as this pool, or have a compatible protocol.
// At present, the compatible protocols are `http` and `https`.
// - Not have a `failsafe_policy.action` of `forward` or `bypass`.
//
// If specified, `action` must be `forward`.
//
// Specify `null` to remove an existing failsafe target pool.
Target LoadBalancerPoolFailsafePolicyTargetPatchIntf `json:"target,omitempty"`
}
// Constants associated with the LoadBalancerPoolFailsafePolicyPatch.Action property.
// A load balancer failsafe policy action:
// - `bypass`: Bypasses the members and sends requests directly to their destination IPs. If specified, this load
// balancer must have `route_mode` enabled.
// - `drop`: Drops requests. If specified, the pool protocol must be `tcp`.
// - `fail`: Fails requests with an HTTP `503` status code. If specified, the pool protocol must be `http` or `https`.
// - `forward`: Forwards requests to the `target` pool. If specified, the pool protocol must be `http` or `https`.
//
// The specified value must be listed in the `failsafe_policy_actions` for this pool's load balancer.
const (
LoadBalancerPoolFailsafePolicyPatchActionBypassConst = "bypass"
LoadBalancerPoolFailsafePolicyPatchActionDropConst = "drop"
LoadBalancerPoolFailsafePolicyPatchActionFailConst = "fail"
LoadBalancerPoolFailsafePolicyPatchActionForwardConst = "forward"
)
// UnmarshalLoadBalancerPoolFailsafePolicyPatch unmarshals an instance of LoadBalancerPoolFailsafePolicyPatch from the specified map of raw messages.
func UnmarshalLoadBalancerPoolFailsafePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerPoolFailsafePolicyPatch)
err = core.UnmarshalPrimitive(m, "action", &obj.Action)
if err != nil {
err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolFailsafePolicyTargetPatch)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the LoadBalancerPoolFailsafePolicyPatch
func (loadBalancerPoolFailsafePolicyPatch *LoadBalancerPoolFailsafePolicyPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerPoolFailsafePolicyPatch.Action) {
_patch["action"] = loadBalancerPoolFailsafePolicyPatch.Action
}
if !core.IsNil(loadBalancerPoolFailsafePolicyPatch.Target) {
_patch["target"] = loadBalancerPoolFailsafePolicyPatch.Target.asPatch()
}
return
}
// LoadBalancerPoolFailsafePolicyPrototype : LoadBalancerPoolFailsafePolicyPrototype struct
type LoadBalancerPoolFailsafePolicyPrototype struct {
// A load balancer failsafe policy action:
// - `bypass`: Bypasses the members and sends requests directly to their destination IPs. If specified, this load
// balancer must have `route_mode` enabled.
// - `drop`: Drops requests. If specified, the pool protocol must be `tcp`.
// - `fail`: Fails requests with an HTTP `503` status code. If specified, the pool protocol must be `http` or `https`.
// - `forward`: Forwards requests to the `target` pool. If specified, the pool protocol must be `http` or `https`.
//
// The specified value must be listed in the `failsafe_policy_actions` for this pool's load balancer.
Action *string `json:"action,omitempty"`
// The failsafe target pool to forward to.
//
// The specified pool must:
// - Belong to this load balancer
// - Have the same `protocol` as this pool, or have a compatible protocol.
// At present, the compatible protocols are `http` and `https`.
// - Have a `failsafe_policy.action` of `fail` or `drop`
//
// If specified, `action` must be `forward`.
Target LoadBalancerPoolIdentityIntf `json:"target,omitempty"`
}
// Constants associated with the LoadBalancerPoolFailsafePolicyPrototype.Action property.
// A load balancer failsafe policy action:
// - `bypass`: Bypasses the members and sends requests directly to their destination IPs. If specified, this load
// balancer must have `route_mode` enabled.
// - `drop`: Drops requests. If specified, the pool protocol must be `tcp`.
// - `fail`: Fails requests with an HTTP `503` status code. If specified, the pool protocol must be `http` or `https`.
// - `forward`: Forwards requests to the `target` pool. If specified, the pool protocol must be `http` or `https`.
//
// The specified value must be listed in the `failsafe_policy_actions` for this pool's load balancer.
const (
LoadBalancerPoolFailsafePolicyPrototypeActionBypassConst = "bypass"
LoadBalancerPoolFailsafePolicyPrototypeActionDropConst = "drop"
LoadBalancerPoolFailsafePolicyPrototypeActionFailConst = "fail"
LoadBalancerPoolFailsafePolicyPrototypeActionForwardConst = "forward"
)
// UnmarshalLoadBalancerPoolFailsafePolicyPrototype unmarshals an instance of LoadBalancerPoolFailsafePolicyPrototype from the specified map of raw messages.
func UnmarshalLoadBalancerPoolFailsafePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerPoolFailsafePolicyPrototype)
err = core.UnmarshalPrimitive(m, "action", &obj.Action)
if err != nil {
err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerPoolFailsafePolicyTargetPatch : The failsafe target pool to forward to.
//
// The specified pool must:
// - Belong to this load balancer
// - Have the same `protocol` as this pool, or have a compatible protocol.
// At present, the compatible protocols are `http` and `https`.
// - Not have a `failsafe_policy.action` of `forward` or `bypass`.
//
// If specified, `action` must be `forward`.
//
// Specify `null` to remove an existing failsafe target pool.
// Models which "extend" this model:
// - LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByID
// - LoadBalancerPoolFailsafePolicyTargetPatchLoadBalancerPoolIdentityByHref
type LoadBalancerPoolFailsafePolicyTargetPatch struct {
// The unique identifier for this load balancer pool.
ID *string `json:"id,omitempty"`
// The URL for this load balancer pool.
Href *string `json:"href,omitempty"`
}
func (*LoadBalancerPoolFailsafePolicyTargetPatch) isaLoadBalancerPoolFailsafePolicyTargetPatch() bool {
return true
}
type LoadBalancerPoolFailsafePolicyTargetPatchIntf interface {
isaLoadBalancerPoolFailsafePolicyTargetPatch() bool
asPatch() map[string]interface{}
}
// UnmarshalLoadBalancerPoolFailsafePolicyTargetPatch unmarshals an instance of LoadBalancerPoolFailsafePolicyTargetPatch from the specified map of raw messages.
func UnmarshalLoadBalancerPoolFailsafePolicyTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerPoolFailsafePolicyTargetPatch)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the LoadBalancerPoolFailsafePolicyTargetPatch
func (loadBalancerPoolFailsafePolicyTargetPatch *LoadBalancerPoolFailsafePolicyTargetPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerPoolFailsafePolicyTargetPatch.ID) {
_patch["id"] = loadBalancerPoolFailsafePolicyTargetPatch.ID
}
if !core.IsNil(loadBalancerPoolFailsafePolicyTargetPatch.Href) {
_patch["href"] = loadBalancerPoolFailsafePolicyTargetPatch.Href
}
return
}
// LoadBalancerPoolHealthMonitor : LoadBalancerPoolHealthMonitor struct
// Models which "extend" this model:
// - LoadBalancerPoolHealthMonitorTypeTCP
// - LoadBalancerPoolHealthMonitorTypeHttphttps
type LoadBalancerPoolHealthMonitor struct {
// The seconds to wait between health checks.
Delay *int64 `json:"delay" validate:"required"`
// The health check max retries.
MaxRetries *int64 `json:"max_retries" validate:"required"`
// The health check port.
//
// If present, this overrides the pool member port values.
Port *int64 `json:"port,omitempty"`
// The seconds to wait for a response to a health check.
Timeout *int64 `json:"timeout" validate:"required"`
// The protocol type used for health checks.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Type *string `json:"type" validate:"required"`
// The health check URL path, 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 used for health checks.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerPoolHealthMonitorTypeHTTPConst = "http"
LoadBalancerPoolHealthMonitorTypeHTTPSConst = "https"
LoadBalancerPoolHealthMonitorTypeTCPConst = "tcp"
)
func (*LoadBalancerPoolHealthMonitor) isaLoadBalancerPoolHealthMonitor() bool {
return true
}
type LoadBalancerPoolHealthMonitorIntf interface {
isaLoadBalancerPoolHealthMonitor() bool
}
// 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 {
err = core.SDKErrorf(err, "", "delay-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries)
if err != nil {
err = core.SDKErrorf(err, "", "max_retries-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port", &obj.Port)
if err != nil {
err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout)
if err != nil {
err = core.SDKErrorf(err, "", "timeout-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath)
if err != nil {
err = core.SDKErrorf(err, "", "url_path-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerPoolHealthMonitorPatch : LoadBalancerPoolHealthMonitorPatch struct
type LoadBalancerPoolHealthMonitorPatch struct {
// The seconds to wait between health checks. Must be greater than `timeout`.
Delay *int64 `json:"delay" validate:"required"`
// The health check max retries.
MaxRetries *int64 `json:"max_retries" validate:"required"`
// The health check port.
//
// If set, this overrides the pool member port values.
//
// Specify `null` to remove an existing health check port.
Port *int64 `json:"port,omitempty"`
// The seconds to wait for a response to a health check. Must be less than `delay`.
Timeout *int64 `json:"timeout" validate:"required"`
// The protocol type to use for health checks.
Type *string `json:"type" validate:"required"`
// The health check URL path. If specified, `type` must be `http` or `https`.
//
// Must be in the format of an [origin-form request target](https://tools.ietf.org/html/rfc7230#section-5.3.1).
//
// Specify `null` to remove a url_path.
URLPath *string `json:"url_path,omitempty"`
}
// Constants associated with the LoadBalancerPoolHealthMonitorPatch.Type property.
// The protocol type to use for health checks.
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")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
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 {
err = core.SDKErrorf(err, "", "delay-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries)
if err != nil {
err = core.SDKErrorf(err, "", "max_retries-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port", &obj.Port)
if err != nil {
err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout)
if err != nil {
err = core.SDKErrorf(err, "", "timeout-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath)
if err != nil {
err = core.SDKErrorf(err, "", "url_path-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the LoadBalancerPoolHealthMonitorPatch
func (loadBalancerPoolHealthMonitorPatch *LoadBalancerPoolHealthMonitorPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerPoolHealthMonitorPatch.Delay) {
_patch["delay"] = loadBalancerPoolHealthMonitorPatch.Delay
}
if !core.IsNil(loadBalancerPoolHealthMonitorPatch.MaxRetries) {
_patch["max_retries"] = loadBalancerPoolHealthMonitorPatch.MaxRetries
}
if !core.IsNil(loadBalancerPoolHealthMonitorPatch.Port) {
_patch["port"] = loadBalancerPoolHealthMonitorPatch.Port
}
if !core.IsNil(loadBalancerPoolHealthMonitorPatch.Timeout) {
_patch["timeout"] = loadBalancerPoolHealthMonitorPatch.Timeout
}
if !core.IsNil(loadBalancerPoolHealthMonitorPatch.Type) {
_patch["type"] = loadBalancerPoolHealthMonitorPatch.Type
}
if !core.IsNil(loadBalancerPoolHealthMonitorPatch.URLPath) {
_patch["url_path"] = loadBalancerPoolHealthMonitorPatch.URLPath
}
return
}
// LoadBalancerPoolHealthMonitorPrototype : LoadBalancerPoolHealthMonitorPrototype struct
// Models which "extend" this model:
// - LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeTCPPrototype
// - LoadBalancerPoolHealthMonitorPrototypeLoadBalancerPoolHealthMonitorTypeHttphttpsPrototype
type LoadBalancerPoolHealthMonitorPrototype struct {
// The seconds to wait between health checks. Must be greater than `timeout`.
Delay *int64 `json:"delay" validate:"required"`
// The health check max retries.
MaxRetries *int64 `json:"max_retries" validate:"required"`
// The health check port.
//
// If specified, this overrides the pool member port values.
Port *int64 `json:"port,omitempty"`
// The seconds to wait for a response to a health check. Must be less than `delay`.
Timeout *int64 `json:"timeout" validate:"required"`
// The protocol type to use for health checks.
Type *string `json:"type" validate:"required"`
// The health check URL path to use.
//
// 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 to use for health checks.
const (
LoadBalancerPoolHealthMonitorPrototypeTypeHTTPConst = "http"
LoadBalancerPoolHealthMonitorPrototypeTypeHTTPSConst = "https"
LoadBalancerPoolHealthMonitorPrototypeTypeTCPConst = "tcp"
)
func (*LoadBalancerPoolHealthMonitorPrototype) isaLoadBalancerPoolHealthMonitorPrototype() bool {
return true
}
type LoadBalancerPoolHealthMonitorPrototypeIntf interface {
isaLoadBalancerPoolHealthMonitorPrototype() bool
}
// 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 {
err = core.SDKErrorf(err, "", "delay-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries)
if err != nil {
err = core.SDKErrorf(err, "", "max_retries-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port", &obj.Port)
if err != nil {
err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout)
if err != nil {
err = core.SDKErrorf(err, "", "timeout-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath)
if err != nil {
err = core.SDKErrorf(err, "", "url_path-error", common.GetComponentInfo())
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:
// - LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID
// - LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref
type LoadBalancerPoolIdentity struct {
// The unique identifier for this load balancer pool.
ID *string `json:"id,omitempty"`
// The URL for this load balancer pool.
Href *string `json:"href,omitempty"`
}
func (*LoadBalancerPoolIdentity) isaLoadBalancerPoolIdentity() bool {
return true
}
type LoadBalancerPoolIdentityIntf interface {
isaLoadBalancerPoolIdentity() bool
asPatch() map[string]interface{}
}
// 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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the LoadBalancerPoolIdentity
func (loadBalancerPoolIdentity *LoadBalancerPoolIdentity) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerPoolIdentity.ID) {
_patch["id"] = loadBalancerPoolIdentity.ID
}
if !core.IsNil(loadBalancerPoolIdentity.Href) {
_patch["href"] = loadBalancerPoolIdentity.Href
}
return
}
// LoadBalancerPoolIdentityByName : LoadBalancerPoolIdentityByName struct
type LoadBalancerPoolIdentityByName struct {
// The name for this load balancer pool. The name is unique across all pools for the load balancer.
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")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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"`
// The health of the member.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Health *string `json:"health" validate:"required"`
// The URL for this load balancer pool member.
Href *string `json:"href" validate:"required"`
// The unique identifier for this load balancer pool member.
ID *string `json:"id" validate:"required"`
// The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a
// listener with a single port. (If the traffic is received on a listener with a port range, the member will receive
// the traffic on the same port the listener received it on.)
//
// This port will also be used for health checks unless the `port` property of
// `health_monitor` property is specified.
Port *int64 `json:"port" validate:"required"`
// The provisioning status of this member
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
ProvisioningStatus *string `json:"provisioning_status" validate:"required"`
// The pool member target.
Target LoadBalancerPoolMemberTargetIntf `json:"target" validate:"required"`
// The weight of the member.
//
// This property will be present if the pool algorithm is `weighted_round_robin`.
Weight *int64 `json:"weight,omitempty"`
}
// Constants associated with the LoadBalancerPoolMember.Health property.
// The health of the member.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerPoolMemberHealthFaultedConst = "faulted"
LoadBalancerPoolMemberHealthOkConst = "ok"
LoadBalancerPoolMemberHealthUnknownConst = "unknown"
)
// Constants associated with the LoadBalancerPoolMember.ProvisioningStatus property.
// The provisioning status of this member
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerPoolMemberProvisioningStatusActiveConst = "active"
LoadBalancerPoolMemberProvisioningStatusCreatePendingConst = "create_pending"
LoadBalancerPoolMemberProvisioningStatusDeletePendingConst = "delete_pending"
LoadBalancerPoolMemberProvisioningStatusFailedConst = "failed"
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 {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "health", &obj.Health)
if err != nil {
err = core.SDKErrorf(err, "", "health-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port", &obj.Port)
if err != nil {
err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus)
if err != nil {
err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTarget)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "weight", &obj.Weight)
if err != nil {
err = core.SDKErrorf(err, "", "weight-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerPoolMemberCollection : LoadBalancerPoolMemberCollection struct
type LoadBalancerPoolMemberCollection struct {
// The members for the load balancer pool.
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 {
err = core.SDKErrorf(err, "", "members-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerPoolMemberPatch : LoadBalancerPoolMemberPatch struct
type LoadBalancerPoolMemberPatch struct {
// The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a
// listener with a single port. (If the traffic is received on a listener with a port range, the member will receive
// the traffic on the same port the listener received it on.)
//
// This port will also be used for health checks unless the `port` property of
// `health_monitor` property is specified.
//
// The port must be unique across all members for all pools associated with this pool's listener.
//
// 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.
Port *int64 `json:"port,omitempty"`
// The pool member target.
//
// If the load balancer has `route_mode` set to `true`, the member must be in a zone the load
// balancer has a subnet in.
//
// 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.
Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target,omitempty"`
// The weight of the member.
//
// If specified, the pool algorithm must be `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 {
err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "weight", &obj.Weight)
if err != nil {
err = core.SDKErrorf(err, "", "weight-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerPoolMemberPatch.Port) {
_patch["port"] = loadBalancerPoolMemberPatch.Port
}
if !core.IsNil(loadBalancerPoolMemberPatch.Target) {
_patch["target"] = loadBalancerPoolMemberPatch.Target.asPatch()
}
if !core.IsNil(loadBalancerPoolMemberPatch.Weight) {
_patch["weight"] = loadBalancerPoolMemberPatch.Weight
}
return
}
// LoadBalancerPoolMemberPrototype : LoadBalancerPoolMemberPrototype struct
type LoadBalancerPoolMemberPrototype struct {
// The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a
// listener with a single port. (If the traffic is received on a listener with a port range, the member will receive
// the traffic on the same port the listener received it on.)
//
// This port will also be used for health checks unless the `port` property of
// `health_monitor` property is specified.
//
// The port must be unique across all members for all pools associated with this pool's listener.
//
// 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.
Port *int64 `json:"port" validate:"required"`
// The pool member target.
//
// If the load balancer has `route_mode` set to `true`, the member must be in a zone the load
// balancer has a subnet in.
//
// 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.
Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"`
// The weight of the member.
//
// If specified, the pool algorithm must be `weighted_round_robin` and the load balancer must be in the `application`
// family.
//
// If unspecified, the weight will be `50` for load balancers in the `application` family.
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")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
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 {
err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "weight", &obj.Weight)
if err != nil {
err = core.SDKErrorf(err, "", "weight-error", common.GetComponentInfo())
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 *Deleted `json:"deleted,omitempty"`
// The URL for this load balancer pool member.
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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerPoolMemberTarget : The pool member target.
// Models which "extend" this model:
// - LoadBalancerPoolMemberTargetInstanceReference
// - LoadBalancerPoolMemberTargetIP
// - LoadBalancerPoolMemberTargetLoadBalancerReference
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 *Deleted `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 name for this virtual server instance. The name is unique across all virtual server instances in the region.
Name *string `json:"name,omitempty"`
// The IP address.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in
// the future.
Address *string `json:"address,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type,omitempty"`
}
// Constants associated with the LoadBalancerPoolMemberTarget.ResourceType property.
// The resource type.
const (
LoadBalancerPoolMemberTargetResourceTypeLoadBalancerConst = "load_balancer"
)
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 {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerPoolMemberTargetPrototype : The pool member target.
//
// If the load balancer has `route_mode` set to `true`, the member must be in a zone the load balancer has a subnet in.
//
// 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.
// Models which "extend" this model:
// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentity
// - LoadBalancerPoolMemberTargetPrototypeIP
// - LoadBalancerPoolMemberTargetPrototypeLoadBalancerIdentity
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 [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in
// the future.
Address *string `json:"address,omitempty"`
}
func (*LoadBalancerPoolMemberTargetPrototype) isaLoadBalancerPoolMemberTargetPrototype() bool {
return true
}
type LoadBalancerPoolMemberTargetPrototypeIntf interface {
isaLoadBalancerPoolMemberTargetPrototype() bool
asPatch() map[string]interface{}
}
// 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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the LoadBalancerPoolMemberTargetPrototype
func (loadBalancerPoolMemberTargetPrototype *LoadBalancerPoolMemberTargetPrototype) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerPoolMemberTargetPrototype.ID) {
_patch["id"] = loadBalancerPoolMemberTargetPrototype.ID
}
if !core.IsNil(loadBalancerPoolMemberTargetPrototype.CRN) {
_patch["crn"] = loadBalancerPoolMemberTargetPrototype.CRN
}
if !core.IsNil(loadBalancerPoolMemberTargetPrototype.Href) {
_patch["href"] = loadBalancerPoolMemberTargetPrototype.Href
}
if !core.IsNil(loadBalancerPoolMemberTargetPrototype.Address) {
_patch["address"] = loadBalancerPoolMemberTargetPrototype.Address
}
return
}
// LoadBalancerPoolPatch : LoadBalancerPoolPatch struct
type LoadBalancerPoolPatch struct {
// The load balancing algorithm. The `least_connections` algorithm is only supported for load balancers that have
// `availability` with value `subnet` in the profile.
Algorithm *string `json:"algorithm,omitempty"`
// The failsafe policy for this load balancer pool.
FailsafePolicy *LoadBalancerPoolFailsafePolicyPatch `json:"failsafe_policy,omitempty"`
// The health monitor of this pool.
//
// If this pool has a member targeting a load balancer then:
//
// - If the targeted load balancer has multiple subnets, this health monitor will be
// used to direct traffic to the available subnets.
// - The health checks spawned by this health monitor will be handled as any other
// traffic (that is, subject to the configuration of listeners and pools on the
// target load balancer).
// - This health monitor does not affect how pool member health is determined within
// the target load balancer.
//
// For more information, see [Private Path network load balancer frequently asked
// questions](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-faqs#ppnlb-faqs).
HealthMonitor *LoadBalancerPoolHealthMonitorPatch `json:"health_monitor,omitempty"`
// The name for this load balancer pool. The name must not be used by another pool for the load balancer.
Name *string `json:"name,omitempty"`
// The protocol for this load balancer pool.
//
// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the
// `application` family support `tcp`, `http` and
// `https`.
//
// If this pool is associated with a load balancer listener or a load balancer failsafe target pool, the specified
// protocol must match or be compatible with each other's protocol. At present, the compatible protocols are `http` and
// `https`.
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
//
// For load balancers in the `network` family, this property must be `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. The `least_connections` algorithm is only supported for load balancers that have
// `availability` with value `subnet` in the profile.
const (
LoadBalancerPoolPatchAlgorithmLeastConnectionsConst = "least_connections"
LoadBalancerPoolPatchAlgorithmRoundRobinConst = "round_robin"
LoadBalancerPoolPatchAlgorithmWeightedRoundRobinConst = "weighted_round_robin"
)
// Constants associated with the LoadBalancerPoolPatch.Protocol property.
// The protocol for this load balancer pool.
//
// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the
// `application` family support `tcp`, `http` and
// `https`.
//
// If this pool is associated with a load balancer listener or a load balancer failsafe target pool, the specified
// protocol must match or be compatible with each other's protocol. At present, the compatible protocols are `http` and
// `https`.
const (
LoadBalancerPoolPatchProtocolHTTPConst = "http"
LoadBalancerPoolPatchProtocolHTTPSConst = "https"
LoadBalancerPoolPatchProtocolTCPConst = "tcp"
LoadBalancerPoolPatchProtocolUDPConst = "udp"
)
// 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
//
// For load balancers in the `network` family, this property must be `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 {
err = core.SDKErrorf(err, "", "algorithm-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "failsafe_policy", &obj.FailsafePolicy, UnmarshalLoadBalancerPoolFailsafePolicyPatch)
if err != nil {
err = core.SDKErrorf(err, "", "failsafe_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPatch)
if err != nil {
err = core.SDKErrorf(err, "", "health_monitor-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol)
if err != nil {
err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol)
if err != nil {
err = core.SDKErrorf(err, "", "proxy_protocol-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePatch)
if err != nil {
err = core.SDKErrorf(err, "", "session_persistence-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerPoolPatch.Algorithm) {
_patch["algorithm"] = loadBalancerPoolPatch.Algorithm
}
if !core.IsNil(loadBalancerPoolPatch.FailsafePolicy) {
_patch["failsafe_policy"] = loadBalancerPoolPatch.FailsafePolicy.asPatch()
}
if !core.IsNil(loadBalancerPoolPatch.HealthMonitor) {
_patch["health_monitor"] = loadBalancerPoolPatch.HealthMonitor.asPatch()
}
if !core.IsNil(loadBalancerPoolPatch.Name) {
_patch["name"] = loadBalancerPoolPatch.Name
}
if !core.IsNil(loadBalancerPoolPatch.Protocol) {
_patch["protocol"] = loadBalancerPoolPatch.Protocol
}
if !core.IsNil(loadBalancerPoolPatch.ProxyProtocol) {
_patch["proxy_protocol"] = loadBalancerPoolPatch.ProxyProtocol
}
if !core.IsNil(loadBalancerPoolPatch.SessionPersistence) {
_patch["session_persistence"] = loadBalancerPoolPatch.SessionPersistence.asPatch()
}
return
}
// LoadBalancerPoolPrototypeLoadBalancerContext : LoadBalancerPoolPrototypeLoadBalancerContext struct
type LoadBalancerPoolPrototypeLoadBalancerContext struct {
// The load balancing algorithm. The `least_connections` algorithm is only supported for load balancers that have
// `availability` with value `subnet` in the profile.
Algorithm *string `json:"algorithm" validate:"required"`
// The health monitor of this pool.
//
// If this pool has a member targeting a load balancer then:
//
// - If the targeted load balancer has multiple subnets, this health monitor will be
// used to direct traffic to the available subnets.
// - The health checks spawned by this health monitor will be handled as any other
// traffic (that is, subject to the configuration of listeners and pools on the target
// load balancer).
// - This health monitor does not affect how pool member health is determined within the
// target load balancer.
//
// For more information, see [Private Path network load balancer frequently asked
// questions](https://cloud.ibm.com/docs/vpc?topic=vpc-nlb-faqs#ppnlb-faqs).
HealthMonitor LoadBalancerPoolHealthMonitorPrototypeIntf `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 name for this load balancer pool. The name must not be used by another pool for the load balancer. 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` and `udp` (if
// `udp_supported` is `true`). 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
//
// For load balancers in the `network` family, this property must be `disabled`.
ProxyProtocol *string `json:"proxy_protocol,omitempty"`
// The session persistence of this pool. If specified, the load balancer must have
// `source_ip_session_persistence_supported` set to `true` in its profile.
//
// If unspecified, session persistence will be disabled, and traffic will be distributed
// across members of the pool.
SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"`
}
// Constants associated with the LoadBalancerPoolPrototypeLoadBalancerContext.Algorithm property.
// The load balancing algorithm. The `least_connections` algorithm is only supported for load balancers that have
// `availability` with value `subnet` in the profile.
const (
LoadBalancerPoolPrototypeLoadBalancerContextAlgorithmLeastConnectionsConst = "least_connections"
LoadBalancerPoolPrototypeLoadBalancerContextAlgorithmRoundRobinConst = "round_robin"
LoadBalancerPoolPrototypeLoadBalancerContextAlgorithmWeightedRoundRobinConst = "weighted_round_robin"
)
// Constants associated with the LoadBalancerPoolPrototypeLoadBalancerContext.Protocol property.
// The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if
// `udp_supported` is `true`). Load balancers in the
// `application` family support `tcp`, `http`, and `https`.
const (
LoadBalancerPoolPrototypeLoadBalancerContextProtocolHTTPConst = "http"
LoadBalancerPoolPrototypeLoadBalancerContextProtocolHTTPSConst = "https"
LoadBalancerPoolPrototypeLoadBalancerContextProtocolTCPConst = "tcp"
LoadBalancerPoolPrototypeLoadBalancerContextProtocolUDPConst = "udp"
)
// Constants associated with the LoadBalancerPoolPrototypeLoadBalancerContext.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
//
// For load balancers in the `network` family, this property must be `disabled`.
const (
LoadBalancerPoolPrototypeLoadBalancerContextProxyProtocolDisabledConst = "disabled"
LoadBalancerPoolPrototypeLoadBalancerContextProxyProtocolV1Const = "v1"
LoadBalancerPoolPrototypeLoadBalancerContextProxyProtocolV2Const = "v2"
)
// NewLoadBalancerPoolPrototypeLoadBalancerContext : Instantiate LoadBalancerPoolPrototypeLoadBalancerContext (Generic Model Constructor)
func (*VpcV1) NewLoadBalancerPoolPrototypeLoadBalancerContext(algorithm string, healthMonitor LoadBalancerPoolHealthMonitorPrototypeIntf, protocol string) (_model *LoadBalancerPoolPrototypeLoadBalancerContext, err error) {
_model = &LoadBalancerPoolPrototypeLoadBalancerContext{
Algorithm: core.StringPtr(algorithm),
HealthMonitor: healthMonitor,
Protocol: core.StringPtr(protocol),
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalLoadBalancerPoolPrototypeLoadBalancerContext unmarshals an instance of LoadBalancerPoolPrototypeLoadBalancerContext from the specified map of raw messages.
func UnmarshalLoadBalancerPoolPrototypeLoadBalancerContext(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerPoolPrototypeLoadBalancerContext)
err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm)
if err != nil {
err = core.SDKErrorf(err, "", "algorithm-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "health_monitor-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "members-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol)
if err != nil {
err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol)
if err != nil {
err = core.SDKErrorf(err, "", "proxy_protocol-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "session_persistence-error", common.GetComponentInfo())
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 *Deleted `json:"deleted,omitempty"`
// The URL for this load balancer pool.
Href *string `json:"href" validate:"required"`
// The unique identifier for this load balancer pool.
ID *string `json:"id" validate:"required"`
// The name for this load balancer pool. The name is unique across all pools for the load balancer.
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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerPoolSessionPersistence : LoadBalancerPoolSessionPersistence struct
type LoadBalancerPoolSessionPersistence struct {
// The session persistence cookie name.
CookieName *string `json:"cookie_name,omitempty"`
// The session persistence type.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Type *string `json:"type" validate:"required"`
}
// Constants associated with the LoadBalancerPoolSessionPersistence.Type property.
// The session persistence type.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerPoolSessionPersistenceTypeAppCookieConst = "app_cookie"
LoadBalancerPoolSessionPersistenceTypeHTTPCookieConst = "http_cookie"
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, "cookie_name", &obj.CookieName)
if err != nil {
err = core.SDKErrorf(err, "", "cookie_name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerPoolSessionPersistencePatch : The session persistence configuration. Specify `null` to remove any existing session persistence configuration.
type LoadBalancerPoolSessionPersistencePatch struct {
// The session persistence cookie name. Names starting with `IBM` are not allowed.
//
// If specified, the session persistence type must be `app_cookie`.
CookieName *string `json:"cookie_name,omitempty"`
// The session persistence type.
//
// If `http_cookie` or `app_cookie` is specified, the pool protocol must be `http` or
// `https`.
Type *string `json:"type,omitempty"`
}
// Constants associated with the LoadBalancerPoolSessionPersistencePatch.Type property.
// The session persistence type.
//
// If `http_cookie` or `app_cookie` is specified, the pool protocol must be `http` or
// `https`.
const (
LoadBalancerPoolSessionPersistencePatchTypeAppCookieConst = "app_cookie"
LoadBalancerPoolSessionPersistencePatchTypeHTTPCookieConst = "http_cookie"
LoadBalancerPoolSessionPersistencePatchTypeSourceIPConst = "source_ip"
)
// 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, "cookie_name", &obj.CookieName)
if err != nil {
err = core.SDKErrorf(err, "", "cookie_name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the LoadBalancerPoolSessionPersistencePatch
func (loadBalancerPoolSessionPersistencePatch *LoadBalancerPoolSessionPersistencePatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(loadBalancerPoolSessionPersistencePatch.CookieName) {
_patch["cookie_name"] = loadBalancerPoolSessionPersistencePatch.CookieName
}
if !core.IsNil(loadBalancerPoolSessionPersistencePatch.Type) {
_patch["type"] = loadBalancerPoolSessionPersistencePatch.Type
}
return
}
// LoadBalancerPoolSessionPersistencePrototype : LoadBalancerPoolSessionPersistencePrototype struct
type LoadBalancerPoolSessionPersistencePrototype struct {
// The session persistence cookie name. Names starting with `IBM` are not allowed.
//
// If specified, the session persistence type must be `app_cookie`.
CookieName *string `json:"cookie_name,omitempty"`
// The session persistence type.
//
// If `http_cookie` or `app_cookie` is specified, the pool protocol must be `http` or
// `https`.
Type *string `json:"type" validate:"required"`
}
// Constants associated with the LoadBalancerPoolSessionPersistencePrototype.Type property.
// The session persistence type.
//
// If `http_cookie` or `app_cookie` is specified, the pool protocol must be `http` or
// `https`.
const (
LoadBalancerPoolSessionPersistencePrototypeTypeAppCookieConst = "app_cookie"
LoadBalancerPoolSessionPersistencePrototypeTypeHTTPCookieConst = "http_cookie"
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")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
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, "cookie_name", &obj.CookieName)
if err != nil {
err = core.SDKErrorf(err, "", "cookie_name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerProfile : LoadBalancerProfile struct
type LoadBalancerProfile struct {
AccessModes *LoadBalancerProfileAccessModes `json:"access_modes" validate:"required"`
Availability LoadBalancerProfileAvailabilityIntf `json:"availability" validate:"required"`
FailsafePolicyActions LoadBalancerProfileFailsafePolicyActionsIntf `json:"failsafe_policy_actions" validate:"required"`
// The product family this load balancer profile belongs to.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Family *string `json:"family" validate:"required"`
// The URL for this load balancer profile.
Href *string `json:"href" validate:"required"`
InstanceGroupsSupported LoadBalancerProfileInstanceGroupsSupportedIntf `json:"instance_groups_supported" 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"`
RouteModeSupported LoadBalancerProfileRouteModeSupportedIntf `json:"route_mode_supported" validate:"required"`
SecurityGroupsSupported LoadBalancerProfileSecurityGroupsSupportedIntf `json:"security_groups_supported" validate:"required"`
SourceIPSessionPersistenceSupported LoadBalancerProfileSourceIPSessionPersistenceSupportedIntf `json:"source_ip_session_persistence_supported" validate:"required"`
// The load balancer profiles that load balancers with this profile can target.
TargetableLoadBalancerProfiles []LoadBalancerProfileReference `json:"targetable_load_balancer_profiles" validate:"required"`
UDPSupported LoadBalancerProfileUDPSupportedIntf `json:"udp_supported" validate:"required"`
}
// Constants associated with the LoadBalancerProfile.Family property.
// The product family this load balancer profile belongs to.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerProfileFamilyApplicationConst = "application"
LoadBalancerProfileFamilyNetworkConst = "network"
)
// 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.UnmarshalModel(m, "access_modes", &obj.AccessModes, UnmarshalLoadBalancerProfileAccessModes)
if err != nil {
err = core.SDKErrorf(err, "", "access_modes-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "availability", &obj.Availability, UnmarshalLoadBalancerProfileAvailability)
if err != nil {
err = core.SDKErrorf(err, "", "availability-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "failsafe_policy_actions", &obj.FailsafePolicyActions, UnmarshalLoadBalancerProfileFailsafePolicyActions)
if err != nil {
err = core.SDKErrorf(err, "", "failsafe_policy_actions-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "family", &obj.Family)
if err != nil {
err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "instance_groups_supported", &obj.InstanceGroupsSupported, UnmarshalLoadBalancerProfileInstanceGroupsSupported)
if err != nil {
err = core.SDKErrorf(err, "", "instance_groups_supported-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "logging_supported", &obj.LoggingSupported, UnmarshalLoadBalancerProfileLoggingSupported)
if err != nil {
err = core.SDKErrorf(err, "", "logging_supported-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "route_mode_supported", &obj.RouteModeSupported, UnmarshalLoadBalancerProfileRouteModeSupported)
if err != nil {
err = core.SDKErrorf(err, "", "route_mode_supported-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "security_groups_supported", &obj.SecurityGroupsSupported, UnmarshalLoadBalancerProfileSecurityGroupsSupported)
if err != nil {
err = core.SDKErrorf(err, "", "security_groups_supported-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "source_ip_session_persistence_supported", &obj.SourceIPSessionPersistenceSupported, UnmarshalLoadBalancerProfileSourceIPSessionPersistenceSupported)
if err != nil {
err = core.SDKErrorf(err, "", "source_ip_session_persistence_supported-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "targetable_load_balancer_profiles", &obj.TargetableLoadBalancerProfiles, UnmarshalLoadBalancerProfileReference)
if err != nil {
err = core.SDKErrorf(err, "", "targetable_load_balancer_profiles-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "udp_supported", &obj.UDPSupported, UnmarshalLoadBalancerProfileUDPSupported)
if err != nil {
err = core.SDKErrorf(err, "", "udp_supported-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerProfileAccessModes : LoadBalancerProfileAccessModes struct
type LoadBalancerProfileAccessModes struct {
// The type for this profile field.
Type *string `json:"type" validate:"required"`
// The access modes supported by load balancers with this profile.
Values []string `json:"values" validate:"required"`
}
// Constants associated with the LoadBalancerProfileAccessModes.Type property.
// The type for this profile field.
const (
LoadBalancerProfileAccessModesTypeEnumConst = "enum"
)
// Constants associated with the LoadBalancerProfileAccessModes.Values property.
// The access mode for this load balancer:
// - `private`: reachable from within its VPC, at IP addresses in `private_ips`
// - `private_path`: reachable through an endpoint gateway
// - `public`: reachable from the internet at the IP addresses in `public_ips`.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerProfileAccessModesValuesPrivateConst = "private"
LoadBalancerProfileAccessModesValuesPrivatePathConst = "private_path"
LoadBalancerProfileAccessModesValuesPublicConst = "public"
)
// UnmarshalLoadBalancerProfileAccessModes unmarshals an instance of LoadBalancerProfileAccessModes from the specified map of raw messages.
func UnmarshalLoadBalancerProfileAccessModes(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerProfileAccessModes)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerProfileAvailability : LoadBalancerProfileAvailability struct
// Models which "extend" this model:
// - LoadBalancerProfileAvailabilityFixed
// - LoadBalancerProfileAvailabilityDependent
type LoadBalancerProfileAvailability struct {
// The type for this profile field.
Type *string `json:"type,omitempty"`
// The availability of this load balancer:
// - `subnet`: remains available if at least one zone that the load balancer's subnets reside
// in is available
// - `region`: remains available if at least one zone in the region is available.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Value *string `json:"value,omitempty"`
}
// Constants associated with the LoadBalancerProfileAvailability.Type property.
// The type for this profile field.
const (
LoadBalancerProfileAvailabilityTypeFixedConst = "fixed"
)
// Constants associated with the LoadBalancerProfileAvailability.Value property.
// The availability of this load balancer:
// - `subnet`: remains available if at least one zone that the load balancer's subnets reside
// in is available
// - `region`: remains available if at least one zone in the region is available.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerProfileAvailabilityValueRegionConst = "region"
LoadBalancerProfileAvailabilityValueSubnetConst = "subnet"
)
func (*LoadBalancerProfileAvailability) isaLoadBalancerProfileAvailability() bool {
return true
}
type LoadBalancerProfileAvailabilityIntf interface {
isaLoadBalancerProfileAvailability() bool
}
// UnmarshalLoadBalancerProfileAvailability unmarshals an instance of LoadBalancerProfileAvailability from the specified map of raw messages.
func UnmarshalLoadBalancerProfileAvailability(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerProfileAvailability)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
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 *PageLink `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 *PageLink `json:"next,omitempty"`
// A page 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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalLoadBalancerProfile)
if err != nil {
err = core.SDKErrorf(err, "", "profiles-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *LoadBalancerProfileCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// LoadBalancerProfileFailsafePolicyActions : LoadBalancerProfileFailsafePolicyActions struct
// Models which "extend" this model:
// - LoadBalancerProfileFailsafePolicyActionsEnum
// - LoadBalancerProfileFailsafePolicyActionsDependent
type LoadBalancerProfileFailsafePolicyActions struct {
// The default failsafe policy action for this profile.
Default *string `json:"default,omitempty"`
// The type for this profile field.
Type *string `json:"type,omitempty"`
// The supported failsafe policy actions.
Values []string `json:"values,omitempty"`
}
// Constants associated with the LoadBalancerProfileFailsafePolicyActions.Default property.
// The default failsafe policy action for this profile.
const (
LoadBalancerProfileFailsafePolicyActionsDefaultBypassConst = "bypass"
LoadBalancerProfileFailsafePolicyActionsDefaultDropConst = "drop"
LoadBalancerProfileFailsafePolicyActionsDefaultFailConst = "fail"
LoadBalancerProfileFailsafePolicyActionsDefaultForwardConst = "forward"
)
// Constants associated with the LoadBalancerProfileFailsafePolicyActions.Type property.
// The type for this profile field.
const (
LoadBalancerProfileFailsafePolicyActionsTypeEnumConst = "enum"
)
// Constants associated with the LoadBalancerProfileFailsafePolicyActions.Values property.
// A load balancer failsafe policy action:
// - `bypass`: Bypasses the members and sends requests directly to their destination IPs.
// - `drop`: Drops requests.
// - `fail`: Fails requests with an HTTP `503` status code.
// - `forward`: Forwards requests to the `target` pool.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerProfileFailsafePolicyActionsValuesBypassConst = "bypass"
LoadBalancerProfileFailsafePolicyActionsValuesDropConst = "drop"
LoadBalancerProfileFailsafePolicyActionsValuesFailConst = "fail"
LoadBalancerProfileFailsafePolicyActionsValuesForwardConst = "forward"
)
func (*LoadBalancerProfileFailsafePolicyActions) isaLoadBalancerProfileFailsafePolicyActions() bool {
return true
}
type LoadBalancerProfileFailsafePolicyActionsIntf interface {
isaLoadBalancerProfileFailsafePolicyActions() bool
}
// UnmarshalLoadBalancerProfileFailsafePolicyActions unmarshals an instance of LoadBalancerProfileFailsafePolicyActions from the specified map of raw messages.
func UnmarshalLoadBalancerProfileFailsafePolicyActions(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerProfileFailsafePolicyActions)
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerProfileInstanceGroupsSupported : LoadBalancerProfileInstanceGroupsSupported struct
// Models which "extend" this model:
// - LoadBalancerProfileInstanceGroupsSupportedFixed
// - LoadBalancerProfileInstanceGroupsSupportedDependent
type LoadBalancerProfileInstanceGroupsSupported 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 LoadBalancerProfileInstanceGroupsSupported.Type property.
// The type for this profile field.
const (
LoadBalancerProfileInstanceGroupsSupportedTypeFixedConst = "fixed"
)
func (*LoadBalancerProfileInstanceGroupsSupported) isaLoadBalancerProfileInstanceGroupsSupported() bool {
return true
}
type LoadBalancerProfileInstanceGroupsSupportedIntf interface {
isaLoadBalancerProfileInstanceGroupsSupported() bool
}
// UnmarshalLoadBalancerProfileInstanceGroupsSupported unmarshals an instance of LoadBalancerProfileInstanceGroupsSupported from the specified map of raw messages.
func UnmarshalLoadBalancerProfileInstanceGroupsSupported(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerProfileInstanceGroupsSupported)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
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.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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"`
}
// Constants associated with the LoadBalancerProfileReference.Family property.
// The product family this load balancer profile belongs to.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
LoadBalancerProfileReferenceFamilyApplicationConst = "application"
LoadBalancerProfileReferenceFamilyNetworkConst = "network"
)
// 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 {
err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerProfileRouteModeSupported : LoadBalancerProfileRouteModeSupported struct
// Models which "extend" this model:
// - LoadBalancerProfileRouteModeSupportedFixed
// - LoadBalancerProfileRouteModeSupportedDependent
type LoadBalancerProfileRouteModeSupported 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 LoadBalancerProfileRouteModeSupported.Type property.
// The type for this profile field.
const (
LoadBalancerProfileRouteModeSupportedTypeFixedConst = "fixed"
)
func (*LoadBalancerProfileRouteModeSupported) isaLoadBalancerProfileRouteModeSupported() bool {
return true
}
type LoadBalancerProfileRouteModeSupportedIntf interface {
isaLoadBalancerProfileRouteModeSupported() bool
}
// UnmarshalLoadBalancerProfileRouteModeSupported unmarshals an instance of LoadBalancerProfileRouteModeSupported from the specified map of raw messages.
func UnmarshalLoadBalancerProfileRouteModeSupported(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerProfileRouteModeSupported)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
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 {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerProfileSourceIPSessionPersistenceSupported : LoadBalancerProfileSourceIPSessionPersistenceSupported struct
// Models which "extend" this model:
// - LoadBalancerProfileSourceIPSessionPersistenceSupportedFixed
// - LoadBalancerProfileSourceIPSessionPersistenceSupportedDependent
type LoadBalancerProfileSourceIPSessionPersistenceSupported 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 LoadBalancerProfileSourceIPSessionPersistenceSupported.Type property.
// The type for this profile field.
const (
LoadBalancerProfileSourceIPSessionPersistenceSupportedTypeFixedConst = "fixed"
)
func (*LoadBalancerProfileSourceIPSessionPersistenceSupported) isaLoadBalancerProfileSourceIPSessionPersistenceSupported() bool {
return true
}
type LoadBalancerProfileSourceIPSessionPersistenceSupportedIntf interface {
isaLoadBalancerProfileSourceIPSessionPersistenceSupported() bool
}
// UnmarshalLoadBalancerProfileSourceIPSessionPersistenceSupported unmarshals an instance of LoadBalancerProfileSourceIPSessionPersistenceSupported from the specified map of raw messages.
func UnmarshalLoadBalancerProfileSourceIPSessionPersistenceSupported(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerProfileSourceIPSessionPersistenceSupported)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerProfileUDPSupported : LoadBalancerProfileUDPSupported struct
// Models which "extend" this model:
// - LoadBalancerProfileUDPSupportedFixed
// - LoadBalancerProfileUDPSupportedDependent
type LoadBalancerProfileUDPSupported 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 LoadBalancerProfileUDPSupported.Type property.
// The type for this profile field.
const (
LoadBalancerProfileUDPSupportedTypeFixedConst = "fixed"
)
func (*LoadBalancerProfileUDPSupported) isaLoadBalancerProfileUDPSupported() bool {
return true
}
type LoadBalancerProfileUDPSupportedIntf interface {
isaLoadBalancerProfileUDPSupported() bool
}
// UnmarshalLoadBalancerProfileUDPSupported unmarshals an instance of LoadBalancerProfileUDPSupported from the specified map of raw messages.
func UnmarshalLoadBalancerProfileUDPSupported(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerProfileUDPSupported)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerReference : LoadBalancerReference struct
type LoadBalancerReference struct {
// The CRN for this load balancer.
CRN *string `json:"crn" validate:"required"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this load balancer.
Href *string `json:"href" validate:"required"`
// The unique identifier for this load balancer.
ID *string `json:"id" validate:"required"`
// The name for this load balancer. The name is unique across all load balancers in the VPC.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the LoadBalancerReference.ResourceType property.
// The resource type.
const (
LoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer"
)
// UnmarshalLoadBalancerReference unmarshals an instance of LoadBalancerReference from the specified map of raw messages.
func UnmarshalLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(LoadBalancerReference)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// LoadBalancerStatistics : LoadBalancerStatistics struct
type LoadBalancerStatistics struct {
// The number of active connections for this load balancer.
ActiveConnections *int64 `json:"active_connections" validate:"required"`
// The current connection rate (connections per second) for this load balancer.
ConnectionRate *float32 `json:"connection_rate" validate:"required"`
// The total number of bytes processed for this load balancer for the current calendar month.
DataProcessedThisMonth *int64 `json:"data_processed_this_month" validate:"required"`
// The current throughput (in Mbps) for 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 {
err = core.SDKErrorf(err, "", "active_connections-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "connection_rate", &obj.ConnectionRate)
if err != nil {
err = core.SDKErrorf(err, "", "connection_rate-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "data_processed_this_month", &obj.DataProcessedThisMonth)
if err != nil {
err = core.SDKErrorf(err, "", "data_processed_this_month-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "throughput", &obj.Throughput)
if err != nil {
err = core.SDKErrorf(err, "", "throughput-error", common.GetComponentInfo())
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 name for this network ACL. The name is unique across all network ACLs for the VPC.
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, no traffic will be allowed.
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 resides in.
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 {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem)
if err != nil {
err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
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 *PageLink `json:"first" validate:"required"`
// The maximum number of resources that can be returned by the request.
Limit *int64 `json:"limit" validate:"required"`
// A page 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 *PageLink `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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_acls", &obj.NetworkAcls, UnmarshalNetworkACL)
if err != nil {
err = core.SDKErrorf(err, "", "network_acls-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *NetworkACLCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// 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
asPatch() map[string]interface{}
}
// 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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the NetworkACLIdentity
func (networkACLIdentity *NetworkACLIdentity) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(networkACLIdentity.ID) {
_patch["id"] = networkACLIdentity.ID
}
if !core.IsNil(networkACLIdentity.CRN) {
_patch["crn"] = networkACLIdentity.CRN
}
if !core.IsNil(networkACLIdentity.Href) {
_patch["href"] = networkACLIdentity.Href
}
return
}
// NetworkACLPatch : NetworkACLPatch struct
type NetworkACLPatch struct {
// The name for this network ACL. The name must not be used by another network ACL for the VPC.
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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(networkACLPatch.Name) {
_patch["name"] = networkACLPatch.Name
}
return
}
// NetworkACLPrototype : NetworkACLPrototype struct
// Models which "extend" this model:
// - NetworkACLPrototypeNetworkACLByRules
// - NetworkACLPrototypeNetworkACLBySourceNetworkACL
type NetworkACLPrototype struct {
// The name for this network ACL. The name must not be used by another network ACL for the VPC. 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The VPC this network ACL will reside in.
VPC VPCIdentityIntf `json:"vpc" validate:"required"`
// The prototype objects for rules to create along with this network ACL. If unspecified, no rules will be created,
// resulting in no traffic being allowed.
Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"`
// The 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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext)
if err != nil {
err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "source_network_acl-error", common.GetComponentInfo())
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 *Deleted `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 name for this network ACL. The name is unique across all network ACLs for the VPC.
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 {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// NetworkACLRule : NetworkACLRule struct
// Models which "extend" this model:
// - NetworkACLRuleNetworkACLRuleProtocolAll
// - NetworkACLRuleNetworkACLRuleProtocolIcmp
// - NetworkACLRuleNetworkACLRuleProtocolTcpudp
type NetworkACLRule struct {
// The action to perform for a packet matching the rule.
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 IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses.
Destination *string `json:"destination" validate:"required"`
// The direction of traffic to match.
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 name for this network ACL rule. The name is unique across all rules for the network ACL.
Name *string `json:"name" validate:"required"`
// The network protocol.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Protocol *string `json:"protocol" validate:"required"`
// The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses.
Source *string `json:"source" validate:"required"`
// The ICMP traffic code to match.
//
// If absent, all codes are matched.
Code *int64 `json:"code,omitempty"`
// The ICMP traffic type to match.
//
// If absent, all types are matched.
Type *int64 `json:"type,omitempty"`
// The inclusive upper bound of the TCP or UDP destination port range.
DestinationPortMax *int64 `json:"destination_port_max,omitempty"`
// The inclusive lower bound of the TCP or UDP destination port range.
DestinationPortMin *int64 `json:"destination_port_min,omitempty"`
// The inclusive upper bound of the TCP or UDP source port range.
SourcePortMax *int64 `json:"source_port_max,omitempty"`
// The inclusive lower bound of the TCP or UDP source port range.
SourcePortMin *int64 `json:"source_port_min,omitempty"`
}
// Constants associated with the NetworkACLRule.Action property.
// The action to perform for a packet matching the rule.
const (
NetworkACLRuleActionAllowConst = "allow"
NetworkACLRuleActionDenyConst = "deny"
)
// Constants associated with the NetworkACLRule.Direction property.
// The direction of traffic to match.
const (
NetworkACLRuleDirectionInboundConst = "inbound"
NetworkACLRuleDirectionOutboundConst = "outbound"
)
// Constants associated with the NetworkACLRule.IPVersion property.
// The IP version for this rule.
const (
NetworkACLRuleIPVersionIpv4Const = "ipv4"
)
// Constants associated with the NetworkACLRule.Protocol property.
// The network protocol.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
NetworkACLRuleProtocolAllConst = "all"
NetworkACLRuleProtocolIcmpConst = "icmp"
NetworkACLRuleProtocolTCPConst = "tcp"
NetworkACLRuleProtocolUDPConst = "udp"
)
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 {
errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error())
err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo())
return
}
if discValue == "" {
err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo())
return
}
if discValue == "all" {
err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleNetworkACLRuleProtocolAll-error", common.GetComponentInfo())
}
} else if discValue == "icmp" {
err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleNetworkACLRuleProtocolIcmp-error", common.GetComponentInfo())
}
} else if discValue == "tcp" {
err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleNetworkACLRuleProtocolTcpudp-error", common.GetComponentInfo())
}
} else if discValue == "udp" {
err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleNetworkACLRuleProtocolTcpudp-error", common.GetComponentInfo())
}
} else {
errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue)
err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo())
}
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
asPatch() map[string]interface{}
}
// 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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the NetworkACLRuleBeforePatch
func (networkACLRuleBeforePatch *NetworkACLRuleBeforePatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(networkACLRuleBeforePatch.ID) {
_patch["id"] = networkACLRuleBeforePatch.ID
}
if !core.IsNil(networkACLRuleBeforePatch.Href) {
_patch["href"] = networkACLRuleBeforePatch.Href
}
return
}
// NetworkACLRuleBeforePrototype : The rule to insert this rule immediately before.
//
// If unspecified, 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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
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 *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of ordered rules (sorted based on the `before` property) for the network ACL.
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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem)
if err != nil {
err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *NetworkACLRuleCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// NetworkACLRuleItem : NetworkACLRuleItem struct
// Models which "extend" this model:
// - NetworkACLRuleItemNetworkACLRuleProtocolAll
// - NetworkACLRuleItemNetworkACLRuleProtocolIcmp
// - NetworkACLRuleItemNetworkACLRuleProtocolTcpudp
type NetworkACLRuleItem struct {
// The action to perform for a packet matching the rule.
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 IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses.
Destination *string `json:"destination" validate:"required"`
// The direction of traffic to match.
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 name for this network ACL rule. The name is unique across all rules for the network ACL.
Name *string `json:"name" validate:"required"`
// The network protocol.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Protocol *string `json:"protocol" validate:"required"`
// The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses.
Source *string `json:"source" validate:"required"`
// The ICMP traffic code to match.
//
// If absent, all codes are matched.
Code *int64 `json:"code,omitempty"`
// The ICMP traffic type to match.
//
// If absent, all types are matched.
Type *int64 `json:"type,omitempty"`
// The inclusive upper bound of the TCP or UDP destination port range.
DestinationPortMax *int64 `json:"destination_port_max,omitempty"`
// The inclusive lower bound of the TCP or UDP destination port range.
DestinationPortMin *int64 `json:"destination_port_min,omitempty"`
// The inclusive upper bound of the TCP or UDP source port range.
SourcePortMax *int64 `json:"source_port_max,omitempty"`
// The inclusive lower bound of the TCP or UDP source port range.
SourcePortMin *int64 `json:"source_port_min,omitempty"`
}
// Constants associated with the NetworkACLRuleItem.Action property.
// The action to perform for a packet matching the rule.
const (
NetworkACLRuleItemActionAllowConst = "allow"
NetworkACLRuleItemActionDenyConst = "deny"
)
// Constants associated with the NetworkACLRuleItem.Direction property.
// The direction of traffic to match.
const (
NetworkACLRuleItemDirectionInboundConst = "inbound"
NetworkACLRuleItemDirectionOutboundConst = "outbound"
)
// Constants associated with the NetworkACLRuleItem.IPVersion property.
// The IP version for this rule.
const (
NetworkACLRuleItemIPVersionIpv4Const = "ipv4"
)
// Constants associated with the NetworkACLRuleItem.Protocol property.
// The network protocol.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
NetworkACLRuleItemProtocolAllConst = "all"
NetworkACLRuleItemProtocolIcmpConst = "icmp"
NetworkACLRuleItemProtocolTCPConst = "tcp"
NetworkACLRuleItemProtocolUDPConst = "udp"
)
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 {
errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error())
err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo())
return
}
if discValue == "" {
err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo())
return
}
if discValue == "all" {
err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleItemNetworkACLRuleProtocolAll-error", common.GetComponentInfo())
}
} else if discValue == "icmp" {
err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleItemNetworkACLRuleProtocolIcmp-error", common.GetComponentInfo())
}
} else if discValue == "tcp" {
err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleItemNetworkACLRuleProtocolTcpudp-error", common.GetComponentInfo())
}
} else if discValue == "udp" {
err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleItemNetworkACLRuleProtocolTcpudp-error", common.GetComponentInfo())
}
} else {
errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue)
err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo())
}
return
}
// NetworkACLRulePatch : NetworkACLRulePatch struct
type NetworkACLRulePatch struct {
// The action to perform for a packet matching the rule.
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 match. If set, `type` must also be set.
//
// Specify `null` to remove an existing ICMP traffic code.
Code *int64 `json:"code,omitempty"`
// The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses.
Destination *string `json:"destination,omitempty"`
// The inclusive upper bound of the TCP or UDP destination port range.
//
// Must be larger than or equal to `destination_port_min`.
DestinationPortMax *int64 `json:"destination_port_max,omitempty"`
// The inclusive lower bound of the TCP or UDP destination port range.
//
// Must be smaller than or equal to `destination_port_max`.
DestinationPortMin *int64 `json:"destination_port_min,omitempty"`
// The direction of traffic to match.
Direction *string `json:"direction,omitempty"`
// The name for this network ACL rule. The name must not be used by another rule for the network ACL.
Name *string `json:"name,omitempty"`
// The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses.
Source *string `json:"source,omitempty"`
// The inclusive upper bound of the TCP or UDP source port range.
//
// Must be larger than or equal to `source_port_min`.
SourcePortMax *int64 `json:"source_port_max,omitempty"`
// The inclusive lower bound of the TCP or UDP source port range.
//
// Must be smaller than or equal to `source_port_max`.
SourcePortMin *int64 `json:"source_port_min,omitempty"`
// The ICMP traffic type to match.
//
// Specify `null` to remove an existing ICMP traffic type value.
Type *int64 `json:"type,omitempty"`
}
// Constants associated with the NetworkACLRulePatch.Action property.
// The action to perform for a packet matching the rule.
const (
NetworkACLRulePatchActionAllowConst = "allow"
NetworkACLRulePatchActionDenyConst = "deny"
)
// Constants associated with the NetworkACLRulePatch.Direction property.
// The direction of traffic to match.
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 {
err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePatch)
if err != nil {
err = core.SDKErrorf(err, "", "before-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "destination", &obj.Destination)
if err != nil {
err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax)
if err != nil {
err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin)
if err != nil {
err = core.SDKErrorf(err, "", "destination_port_min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "direction", &obj.Direction)
if err != nil {
err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "source", &obj.Source)
if err != nil {
err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax)
if err != nil {
err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin)
if err != nil {
err = core.SDKErrorf(err, "", "source_port_min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(networkACLRulePatch.Action) {
_patch["action"] = networkACLRulePatch.Action
}
if !core.IsNil(networkACLRulePatch.Before) {
_patch["before"] = networkACLRulePatch.Before.asPatch()
}
if !core.IsNil(networkACLRulePatch.Code) {
_patch["code"] = networkACLRulePatch.Code
}
if !core.IsNil(networkACLRulePatch.Destination) {
_patch["destination"] = networkACLRulePatch.Destination
}
if !core.IsNil(networkACLRulePatch.DestinationPortMax) {
_patch["destination_port_max"] = networkACLRulePatch.DestinationPortMax
}
if !core.IsNil(networkACLRulePatch.DestinationPortMin) {
_patch["destination_port_min"] = networkACLRulePatch.DestinationPortMin
}
if !core.IsNil(networkACLRulePatch.Direction) {
_patch["direction"] = networkACLRulePatch.Direction
}
if !core.IsNil(networkACLRulePatch.Name) {
_patch["name"] = networkACLRulePatch.Name
}
if !core.IsNil(networkACLRulePatch.Source) {
_patch["source"] = networkACLRulePatch.Source
}
if !core.IsNil(networkACLRulePatch.SourcePortMax) {
_patch["source_port_max"] = networkACLRulePatch.SourcePortMax
}
if !core.IsNil(networkACLRulePatch.SourcePortMin) {
_patch["source_port_min"] = networkACLRulePatch.SourcePortMin
}
if !core.IsNil(networkACLRulePatch.Type) {
_patch["type"] = networkACLRulePatch.Type
}
return
}
// NetworkACLRulePrototype : NetworkACLRulePrototype struct
// Models which "extend" this model:
// - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype
// - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype
// - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype
type NetworkACLRulePrototype struct {
// The action to perform for a packet matching the rule.
Action *string `json:"action" validate:"required"`
// The rule to insert this rule immediately before.
//
// If unspecified, this rule will be inserted after all existing rules.
Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"`
// The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses.
Destination *string `json:"destination" validate:"required"`
// The direction of traffic to match.
Direction *string `json:"direction" validate:"required"`
// The IP version for this rule.
IPVersion *string `json:"ip_version,omitempty"`
// The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified,
// the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The network protocol.
Protocol *string `json:"protocol" validate:"required"`
// The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses.
Source *string `json:"source" validate:"required"`
// The ICMP traffic code to match.
//
// If specified, `type` must also be specified. If unspecified, all codes are matched.
Code *int64 `json:"code,omitempty"`
// The ICMP traffic type to match.
//
// If unspecified, all types are matched.
Type *int64 `json:"type,omitempty"`
// The inclusive upper bound of the TCP or UDP destination port range.
//
// If specified, `destination_port_min` must also be specified, and must not be larger. If unspecified,
// `destination_port_min` must also be unspecified, allowing traffic for all destination ports.
DestinationPortMax *int64 `json:"destination_port_max,omitempty"`
// The inclusive lower bound of the TCP or UDP destination port range.
//
// If specified, `destination_port_max` must also be specified, and must not be smaller. If unspecified,
// `destination_port_max` must also be unspecified, allowing traffic for all destination ports.
DestinationPortMin *int64 `json:"destination_port_min,omitempty"`
// The inclusive upper bound of the TCP or UDP source port range.
//
// If specified, `source_port_min` must also be specified, and must not be larger. If unspecified, `source_port_min`
// must also be unspecified, allowing traffic for all source ports.
SourcePortMax *int64 `json:"source_port_max,omitempty"`
// The inclusive lower bound of the TCP or UDP source port range.
//
// If specified, `source_port_max` must also be specified, and must not be smaller. If unspecified, `source_port_max`
// must also be unspecified, allowing traffic for all source ports.
SourcePortMin *int64 `json:"source_port_min,omitempty"`
}
// Constants associated with the NetworkACLRulePrototype.Action property.
// The action to perform for a packet matching the rule.
const (
NetworkACLRulePrototypeActionAllowConst = "allow"
NetworkACLRulePrototypeActionDenyConst = "deny"
)
// Constants associated with the NetworkACLRulePrototype.Direction property.
// The direction of traffic to match.
const (
NetworkACLRulePrototypeDirectionInboundConst = "inbound"
NetworkACLRulePrototypeDirectionOutboundConst = "outbound"
)
// Constants associated with the NetworkACLRulePrototype.IPVersion property.
// The IP version for this rule.
const (
NetworkACLRulePrototypeIPVersionIpv4Const = "ipv4"
)
// Constants associated with the NetworkACLRulePrototype.Protocol property.
// The network protocol.
const (
NetworkACLRulePrototypeProtocolAllConst = "all"
NetworkACLRulePrototypeProtocolIcmpConst = "icmp"
NetworkACLRulePrototypeProtocolTCPConst = "tcp"
NetworkACLRulePrototypeProtocolUDPConst = "udp"
)
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) {
obj := new(NetworkACLRulePrototype)
err = core.UnmarshalPrimitive(m, "action", &obj.Action)
if err != nil {
err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "before-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "destination", &obj.Destination)
if err != nil {
err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "direction", &obj.Direction)
if err != nil {
err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion)
if err != nil {
err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol)
if err != nil {
err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "source", &obj.Source)
if err != nil {
err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax)
if err != nil {
err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin)
if err != nil {
err = core.SDKErrorf(err, "", "destination_port_min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax)
if err != nil {
err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin)
if err != nil {
err = core.SDKErrorf(err, "", "source_port_min-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// NetworkACLRulePrototypeNetworkACLContext : NetworkACLRulePrototypeNetworkACLContext struct
// Models which "extend" this model:
// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype
// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype
// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype
type NetworkACLRulePrototypeNetworkACLContext struct {
// The action to perform for a packet matching the rule.
Action *string `json:"action" validate:"required"`
// The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses.
Destination *string `json:"destination" validate:"required"`
// The direction of traffic to match.
Direction *string `json:"direction" validate:"required"`
// The IP version for this rule.
IPVersion *string `json:"ip_version,omitempty"`
// The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified,
// the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The network protocol.
Protocol *string `json:"protocol" validate:"required"`
// The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses.
Source *string `json:"source" validate:"required"`
// The ICMP traffic code to match.
//
// If specified, `type` must also be specified. If unspecified, all codes are matched.
Code *int64 `json:"code,omitempty"`
// The ICMP traffic type to match.
//
// If unspecified, all types are matched.
Type *int64 `json:"type,omitempty"`
// The inclusive upper bound of the TCP or UDP destination port range.
//
// If specified, `destination_port_min` must also be specified, and must not be larger. If unspecified,
// `destination_port_min` must also be unspecified, allowing traffic for all destination ports.
DestinationPortMax *int64 `json:"destination_port_max,omitempty"`
// The inclusive lower bound of the TCP or UDP destination port range.
//
// If specified, `destination_port_max` must also be specified, and must not be smaller. If unspecified,
// `destination_port_max` must also be unspecified, allowing traffic for all destination ports.
DestinationPortMin *int64 `json:"destination_port_min,omitempty"`
// The inclusive upper bound of the TCP or UDP source port range.
//
// If specified, `source_port_min` must also be specified, and must not be larger. If unspecified, `source_port_min`
// must also be unspecified, allowing traffic for all source ports.
SourcePortMax *int64 `json:"source_port_max,omitempty"`
// The inclusive lower bound of the TCP or UDP source port range.
//
// If specified, `source_port_max` must also be specified, and must not be smaller. If unspecified, `source_port_max`
// must also be unspecified, allowing traffic for all source ports.
SourcePortMin *int64 `json:"source_port_min,omitempty"`
}
// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Action property.
// The action to perform for a packet matching the rule.
const (
NetworkACLRulePrototypeNetworkACLContextActionAllowConst = "allow"
NetworkACLRulePrototypeNetworkACLContextActionDenyConst = "deny"
)
// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Direction property.
// The direction of traffic to match.
const (
NetworkACLRulePrototypeNetworkACLContextDirectionInboundConst = "inbound"
NetworkACLRulePrototypeNetworkACLContextDirectionOutboundConst = "outbound"
)
// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.IPVersion property.
// The IP version for this rule.
const (
NetworkACLRulePrototypeNetworkACLContextIPVersionIpv4Const = "ipv4"
)
// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Protocol property.
// The network protocol.
const (
NetworkACLRulePrototypeNetworkACLContextProtocolAllConst = "all"
NetworkACLRulePrototypeNetworkACLContextProtocolIcmpConst = "icmp"
NetworkACLRulePrototypeNetworkACLContextProtocolTCPConst = "tcp"
NetworkACLRulePrototypeNetworkACLContextProtocolUDPConst = "udp"
)
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) {
obj := new(NetworkACLRulePrototypeNetworkACLContext)
err = core.UnmarshalPrimitive(m, "action", &obj.Action)
if err != nil {
err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "destination", &obj.Destination)
if err != nil {
err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "direction", &obj.Direction)
if err != nil {
err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion)
if err != nil {
err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol)
if err != nil {
err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "source", &obj.Source)
if err != nil {
err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax)
if err != nil {
err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin)
if err != nil {
err = core.SDKErrorf(err, "", "destination_port_min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax)
if err != nil {
err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin)
if err != nil {
err = core.SDKErrorf(err, "", "source_port_min-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// NetworkACLRuleReference : NetworkACLRuleReference struct
type NetworkACLRuleReference struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `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 name for this network ACL rule. The name is unique across all rules for the network ACL.
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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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 instance network interface.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on
// the attached virtual network interface.
AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"`
// The date and time that the instance network interface was created.
//
// If this instance has network attachments, this network interface was created as a [read-only
// representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) when its corresponding
// network attachment was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The floating IPs associated with this instance network interface.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the floating IPs are associated
// with the attached virtual network interface.
FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"`
// The URL for this instance network interface.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment.
Href *string `json:"href" validate:"required"`
// The unique identifier for this instance network interface.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the identifier is that of the
// corresponding network attachment.
ID *string `json:"id" validate:"required"`
// The name for this instance network interface.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the name matches its corresponding
// network attachment.
Name *string `json:"name" validate:"required"`
// The instance network interface port speed in Mbps.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the port speed is that of its
// corresponding network attachment.
PortSpeed *int64 `json:"port_speed" validate:"required"`
// The primary IP address of this instance network interface.
PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The security groups targeting this instance network interface.
//
// If this instance has network attachments, this network interface is a [read-only
// representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its corresponding network
// attachment and its attached virtual network interface, and the security groups are associated with the attached
// virtual network interface.
SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"`
// The status of the instance network interface.
//
// If this instance has network attachments, this network interface is a read-only representation of its corresponding
// network attachment and its attached virtual network interface, and the status is [computed from
// them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients).
Status *string `json:"status" validate:"required"`
// The associated subnet.
Subnet *SubnetReference `json:"subnet" validate:"required"`
// The instance network interface type.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the type is that of its
// corresponding network attachment.
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 instance network interface.
//
// If this instance has network attachments, this network interface is a read-only representation of its corresponding
// network attachment and its attached virtual network interface, and the status is [computed from
// them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients).
const (
NetworkInterfaceStatusAvailableConst = "available"
NetworkInterfaceStatusDeletingConst = "deleting"
NetworkInterfaceStatusFailedConst = "failed"
NetworkInterfaceStatusPendingConst = "pending"
)
// Constants associated with the NetworkInterface.Type property.
// The instance network interface type.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the type is that of its
// corresponding network attachment.
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 {
err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "floating_ips-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed)
if err != nil {
err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// NetworkInterfaceBareMetalServerContextReference : NetworkInterfaceBareMetalServerContextReference struct
type NetworkInterfaceBareMetalServerContextReference struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment.
Href *string `json:"href" validate:"required"`
// The unique identifier for this bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the identifier is that of the
// corresponding network attachment.
ID *string `json:"id" validate:"required"`
// The name for this bare metal server network interface.
Name *string `json:"name" validate:"required"`
// The primary IP address of this bare metal server network interface.
PrimaryIP *ReservedIPReference `json:"primary_ip" 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 NetworkInterfaceBareMetalServerContextReference.ResourceType property.
// The resource type.
const (
NetworkInterfaceBareMetalServerContextReferenceResourceTypeNetworkInterfaceConst = "network_interface"
)
// UnmarshalNetworkInterfaceBareMetalServerContextReference unmarshals an instance of NetworkInterfaceBareMetalServerContextReference from the specified map of raw messages.
func UnmarshalNetworkInterfaceBareMetalServerContextReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(NetworkInterfaceBareMetalServerContextReference)
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// NetworkInterfaceIPPrototype : NetworkInterfaceIPPrototype struct
// Models which "extend" this model:
// - NetworkInterfaceIPPrototypeReservedIPIdentity
// - NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext
type NetworkInterfaceIPPrototype struct {
// The unique identifier for this reserved IP.
ID *string `json:"id,omitempty"`
// The URL for this reserved IP.
Href *string `json:"href,omitempty"`
// The IP address to reserve, which must not already be reserved on the subnet.
//
// If unspecified, an available address on the subnet will automatically be selected.
Address *string `json:"address,omitempty"`
// Indicates whether this reserved IP member will be automatically deleted when either
// `target` is deleted, or the reserved IP is unbound.
AutoDelete *bool `json:"auto_delete,omitempty"`
// The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with
// `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated
// list of randomly-selected words.
Name *string `json:"name,omitempty"`
}
func (*NetworkInterfaceIPPrototype) isaNetworkInterfaceIPPrototype() bool {
return true
}
type NetworkInterfaceIPPrototypeIntf interface {
isaNetworkInterfaceIPPrototype() bool
}
// UnmarshalNetworkInterfaceIPPrototype unmarshals an instance of NetworkInterfaceIPPrototype from the specified map of raw messages.
func UnmarshalNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(NetworkInterfaceIPPrototype)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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 *Deleted `json:"deleted,omitempty"`
// The URL for this instance network interface.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment.
Href *string `json:"href" validate:"required"`
// The unique identifier for this instance network interface.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the identifier is that of the
// corresponding network attachment.
ID *string `json:"id" validate:"required"`
// The name for this instance network interface.
Name *string `json:"name" validate:"required"`
// The primary IP address of this instance network interface.
PrimaryIP *ReservedIPReference `json:"primary_ip" 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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
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 instance network interface.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on
// the attached virtual network interface.
AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"`
// The name for the instance network interface. The name must not be used by another network interface on the virtual
// server instance.
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 {
err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(networkInterfacePatch.AllowIPSpoofing) {
_patch["allow_ip_spoofing"] = networkInterfacePatch.AllowIPSpoofing
}
if !core.IsNil(networkInterfacePatch.Name) {
_patch["name"] = networkInterfacePatch.Name
}
return
}
// NetworkInterfacePrototype : NetworkInterfacePrototype struct
type NetworkInterfacePrototype struct {
// Indicates whether source IP spoofing is allowed on this instance network interface.
//
// If this instance has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and source IP spoofing is managed on
// the attached virtual network interface.
AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"`
// The name for the instance network interface. The name must not be used by another network interface on the virtual
// server instance. If unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The primary IP address to bind to the instance network interface. This can be
// specified using an existing reserved IP, or a prototype object for a new reserved IP.
//
// If an existing reserved IP or a prototype object with an address is specified, it must
// be available on the instance network interface's subnet. Otherwise, an
// available address on the subnet will be automatically selected and reserved.
PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"`
// The security groups to use for this instance network interface. If unspecified, the VPC's default security group is
// used.
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")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
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 {
err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// NetworkInterfaceUnpaginatedCollection : NetworkInterfaceUnpaginatedCollection struct
type NetworkInterfaceUnpaginatedCollection struct {
// The network interfaces for the instance.
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 {
err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ObsoleteImageOptions : The ObsoleteImage options.
type ObsoleteImageOptions struct {
// The image identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewObsoleteImageOptions : Instantiate ObsoleteImageOptions
func (*VpcV1) NewObsoleteImageOptions(id string) *ObsoleteImageOptions {
return &ObsoleteImageOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *ObsoleteImageOptions) SetID(id string) *ObsoleteImageOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ObsoleteImageOptions) SetHeaders(param map[string]string) *ObsoleteImageOptions {
options.Headers = param
return options
}
// OperatingSystem : OperatingSystem struct
type OperatingSystem struct {
// Indicates that 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"`
// Indicates that images with this operating system can only be used on dedicated hosts and 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 software family for this operating system.
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 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())
return
}
err = core.UnmarshalPrimitive(m, "dedicated_host_only", &obj.DedicatedHostOnly)
if err != nil {
err = core.SDKErrorf(err, "", "dedicated_host_only-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName)
if err != nil {
err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "family", &obj.Family)
if err != nil {
err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
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())
return
}
err = core.UnmarshalPrimitive(m, "version", &obj.Version)
if err != nil {
err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo())
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 *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of operating systems.
OperatingSystems []OperatingSystem `json:"operating_systems" validate:"required"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" 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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "operating_systems", &obj.OperatingSystems, UnmarshalOperatingSystem)
if err != nil {
err = core.SDKErrorf(err, "", "operating_systems-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *OperatingSystemCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// 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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// PageLink : PageLink struct
type PageLink struct {
// The URL for a page of resources.
Href *string `json:"href" validate:"required"`
}
// UnmarshalPageLink unmarshals an instance of PageLink from the specified map of raw messages.
func UnmarshalPageLink(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PageLink)
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions : The PermitPrivatePathServiceGatewayEndpointGatewayBinding options.
type PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions struct {
// The private path service gateway identifier.
PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="`
// The endpoint gateway binding identifier.
ID *string `json:"id" validate:"required,ne="`
// Indicates whether this will become the access policy for any `pending` and future endpoint gateway bindings from the
// same account.
//
// If set to `true`:
//
// - If the account has an existing access policy, that policy will be updated to
// `permit`. Otherwise, a new `permit` access policy will be created for the account.
// - All `pending` endpoint gateway bindings for the account will be permitted.
//
// If set to `false`:
//
// - No access policies will be created or updated
// - All `pending` endpoint gateway bindings for the account will remain `pending`.
SetAccountPolicy *bool `json:"set_account_policy,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewPermitPrivatePathServiceGatewayEndpointGatewayBindingOptions : Instantiate PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions
func (*VpcV1) NewPermitPrivatePathServiceGatewayEndpointGatewayBindingOptions(privatePathServiceGatewayID string, id string) *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions {
return &PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions{
PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID),
ID: core.StringPtr(id),
}
}
// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID
func (_options *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions {
_options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID)
return _options
}
// SetID : Allow user to set ID
func (_options *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetID(id string) *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetSetAccountPolicy : Allow user to set SetAccountPolicy
func (_options *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetSetAccountPolicy(setAccountPolicy bool) *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions {
_options.SetAccountPolicy = core.BoolPtr(setAccountPolicy)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetHeaders(param map[string]string) *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions {
options.Headers = param
return options
}
// PlacementGroup : PlacementGroup struct
type PlacementGroup struct {
// The date and time that the placement group was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The CRN for this placement group.
CRN *string `json:"crn" validate:"required"`
// The URL for this placement group.
Href *string `json:"href" validate:"required"`
// The unique identifier for this placement group.
ID *string `json:"id" validate:"required"`
// The lifecycle state of the placement group.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The name for this placement group. The name is unique across all placement groups in the region.
Name *string `json:"name" validate:"required"`
// The resource group for this placement group.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The strategy for this placement group:
// - `host_spread`: place on different compute hosts
// - `power_spread`: place on compute hosts that use different power sources
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Strategy *string `json:"strategy" validate:"required"`
}
// Constants associated with the PlacementGroup.LifecycleState property.
// The lifecycle state of the placement group.
const (
PlacementGroupLifecycleStateDeletingConst = "deleting"
PlacementGroupLifecycleStateFailedConst = "failed"
PlacementGroupLifecycleStatePendingConst = "pending"
PlacementGroupLifecycleStateStableConst = "stable"
PlacementGroupLifecycleStateSuspendedConst = "suspended"
PlacementGroupLifecycleStateUpdatingConst = "updating"
PlacementGroupLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the PlacementGroup.ResourceType property.
// The resource type.
const (
PlacementGroupResourceTypePlacementGroupConst = "placement_group"
)
// Constants associated with the PlacementGroup.Strategy property.
// The strategy for this placement group:
// - `host_spread`: place on different compute hosts
// - `power_spread`: place on compute hosts that use different power sources
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
PlacementGroupStrategyHostSpreadConst = "host_spread"
PlacementGroupStrategyPowerSpreadConst = "power_spread"
)
// UnmarshalPlacementGroup unmarshals an instance of PlacementGroup from the specified map of raw messages.
func UnmarshalPlacementGroup(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PlacementGroup)
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "strategy", &obj.Strategy)
if err != nil {
err = core.SDKErrorf(err, "", "strategy-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// PlacementGroupCollection : PlacementGroupCollection struct
type PlacementGroupCollection struct {
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of placement groups.
PlacementGroups []PlacementGroup `json:"placement_groups" validate:"required"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalPlacementGroupCollection unmarshals an instance of PlacementGroupCollection from the specified map of raw messages.
func UnmarshalPlacementGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PlacementGroupCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "placement_groups", &obj.PlacementGroups, UnmarshalPlacementGroup)
if err != nil {
err = core.SDKErrorf(err, "", "placement_groups-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *PlacementGroupCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// PlacementGroupPatch : PlacementGroupPatch struct
type PlacementGroupPatch struct {
// The name for this placement group. The name must not be used by another placement group in the region.
Name *string `json:"name,omitempty"`
}
// UnmarshalPlacementGroupPatch unmarshals an instance of PlacementGroupPatch from the specified map of raw messages.
func UnmarshalPlacementGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PlacementGroupPatch)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the PlacementGroupPatch
func (placementGroupPatch *PlacementGroupPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(placementGroupPatch.Name) {
_patch["name"] = placementGroupPatch.Name
}
return
}
// PrivatePathServiceGateway : PrivatePathServiceGateway struct
type PrivatePathServiceGateway struct {
// The date and time that the private path service gateway was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The CRN for this private path service gateway.
CRN *string `json:"crn" validate:"required"`
// The policy to use for bindings from accounts without an explicit account policy.
DefaultAccessPolicy *string `json:"default_access_policy" validate:"required"`
// Indicates whether endpoint gateway bindings will be automatically deleted after
// `endpoint_gateway_binding_auto_delete_timeout` hours have passed. At present, this is always `true`, but may be
// modifiable in the future.
EndpointGatewayBindingAutoDelete *bool `json:"endpoint_gateway_binding_auto_delete" validate:"required"`
// If `endpoint_gateway_binding_auto_delete` is `true`, the hours after which endpoint gateway bindings will be
// automatically deleted. If the value is `0`, `abandoned` endpoint gateway bindings will be deleted immediately. At
// present, this is always set to `0`. This value may be modifiable in the future.
EndpointGatewayBindingAutoDeleteTimeout *int64 `json:"endpoint_gateway_binding_auto_delete_timeout" validate:"required"`
// The number of active endpoint gateways using this private path service gateway.
EndpointGatewayCount *int64 `json:"endpoint_gateway_count" validate:"required"`
// The URL for this private path service gateway.
Href *string `json:"href" validate:"required"`
// The unique identifier for this private path service gateway.
ID *string `json:"id" validate:"required"`
// The lifecycle state of the private path service gateway.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The load balancer for this private path service gateway.
LoadBalancer *LoadBalancerReference `json:"load_balancer" validate:"required"`
// The name for this private path service gateway. The name is unique across all private path service gateways in the
// VPC.
Name *string `json:"name" validate:"required"`
// Indicates the availability of this private path service gateway
// - `true`: Any account can request access to this private path service gateway.
// - `false`: Access is restricted to the account that created this private path service gateway.
Published *bool `json:"published" validate:"required"`
// The resource group for this private path service gateway.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The fully qualified domain names for this private path service gateway. The domains are used for endpoint gateways
// to connect to the service and are configured in the VPC for each endpoint gateway.
ServiceEndpoints []string `json:"service_endpoints" validate:"required"`
// The VPC this private path service gateway resides in.
VPC *VPCReference `json:"vpc" validate:"required"`
// Indicates whether this private path service gateway has zonal affinity.
// - `true`: Traffic to the service from a zone the service resides in will remain in
// that zone.
// - `false`: Traffic to the service from a zone will be load balanced across all zones
// in the region the service resides in.
ZonalAffinity *bool `json:"zonal_affinity" validate:"required"`
}
// Constants associated with the PrivatePathServiceGateway.DefaultAccessPolicy property.
// The policy to use for bindings from accounts without an explicit account policy.
const (
PrivatePathServiceGatewayDefaultAccessPolicyDenyConst = "deny"
PrivatePathServiceGatewayDefaultAccessPolicyPermitConst = "permit"
PrivatePathServiceGatewayDefaultAccessPolicyReviewConst = "review"
)
// Constants associated with the PrivatePathServiceGateway.LifecycleState property.
// The lifecycle state of the private path service gateway.
const (
PrivatePathServiceGatewayLifecycleStateDeletingConst = "deleting"
PrivatePathServiceGatewayLifecycleStateFailedConst = "failed"
PrivatePathServiceGatewayLifecycleStatePendingConst = "pending"
PrivatePathServiceGatewayLifecycleStateStableConst = "stable"
PrivatePathServiceGatewayLifecycleStateSuspendedConst = "suspended"
PrivatePathServiceGatewayLifecycleStateUpdatingConst = "updating"
PrivatePathServiceGatewayLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the PrivatePathServiceGateway.ResourceType property.
// The resource type.
const (
PrivatePathServiceGatewayResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway"
)
// UnmarshalPrivatePathServiceGateway unmarshals an instance of PrivatePathServiceGateway from the specified map of raw messages.
func UnmarshalPrivatePathServiceGateway(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PrivatePathServiceGateway)
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default_access_policy", &obj.DefaultAccessPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "default_access_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "endpoint_gateway_binding_auto_delete", &obj.EndpointGatewayBindingAutoDelete)
if err != nil {
err = core.SDKErrorf(err, "", "endpoint_gateway_binding_auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "endpoint_gateway_binding_auto_delete_timeout", &obj.EndpointGatewayBindingAutoDeleteTimeout)
if err != nil {
err = core.SDKErrorf(err, "", "endpoint_gateway_binding_auto_delete_timeout-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "endpoint_gateway_count", &obj.EndpointGatewayCount)
if err != nil {
err = core.SDKErrorf(err, "", "endpoint_gateway_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "load_balancer", &obj.LoadBalancer, UnmarshalLoadBalancerReference)
if err != nil {
err = core.SDKErrorf(err, "", "load_balancer-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "published", &obj.Published)
if err != nil {
err = core.SDKErrorf(err, "", "published-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "service_endpoints", &obj.ServiceEndpoints)
if err != nil {
err = core.SDKErrorf(err, "", "service_endpoints-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "zonal_affinity", &obj.ZonalAffinity)
if err != nil {
err = core.SDKErrorf(err, "", "zonal_affinity-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// PrivatePathServiceGatewayAccountPolicy : PrivatePathServiceGatewayAccountPolicy struct
type PrivatePathServiceGatewayAccountPolicy struct {
// The access policy for the account:
// - permit: access will be permitted
// - deny: access will be denied
// - review: access will be manually reviewed
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
AccessPolicy *string `json:"access_policy" validate:"required"`
// The account for this access policy.
Account *AccountReference `json:"account" validate:"required"`
// The date and time that the account policy was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The URL for this account policy.
Href *string `json:"href" validate:"required"`
// The unique identifier for this account policy.
ID *string `json:"id" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the PrivatePathServiceGatewayAccountPolicy.AccessPolicy property.
// The access policy for the account:
// - permit: access will be permitted
// - deny: access will be denied
// - review: access will be manually reviewed
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
PrivatePathServiceGatewayAccountPolicyAccessPolicyDenyConst = "deny"
PrivatePathServiceGatewayAccountPolicyAccessPolicyPermitConst = "permit"
PrivatePathServiceGatewayAccountPolicyAccessPolicyReviewConst = "review"
)
// Constants associated with the PrivatePathServiceGatewayAccountPolicy.ResourceType property.
// The resource type.
const (
PrivatePathServiceGatewayAccountPolicyResourceTypePrivatePathServiceGatewayAccountPolicyConst = "private_path_service_gateway_account_policy"
)
// UnmarshalPrivatePathServiceGatewayAccountPolicy unmarshals an instance of PrivatePathServiceGatewayAccountPolicy from the specified map of raw messages.
func UnmarshalPrivatePathServiceGatewayAccountPolicy(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PrivatePathServiceGatewayAccountPolicy)
err = core.UnmarshalPrimitive(m, "access_policy", &obj.AccessPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "access_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference)
if err != nil {
err = core.SDKErrorf(err, "", "account-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// PrivatePathServiceGatewayAccountPolicyCollection : PrivatePathServiceGatewayAccountPolicyCollection struct
type PrivatePathServiceGatewayAccountPolicyCollection struct {
// A page of account policies for the private path service gateway.
AccountPolicies []PrivatePathServiceGatewayAccountPolicy `json:"account_policies" validate:"required"`
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalPrivatePathServiceGatewayAccountPolicyCollection unmarshals an instance of PrivatePathServiceGatewayAccountPolicyCollection from the specified map of raw messages.
func UnmarshalPrivatePathServiceGatewayAccountPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PrivatePathServiceGatewayAccountPolicyCollection)
err = core.UnmarshalModel(m, "account_policies", &obj.AccountPolicies, UnmarshalPrivatePathServiceGatewayAccountPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "account_policies-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *PrivatePathServiceGatewayAccountPolicyCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// PrivatePathServiceGatewayAccountPolicyPatch : PrivatePathServiceGatewayAccountPolicyPatch struct
type PrivatePathServiceGatewayAccountPolicyPatch struct {
// The access policy for the account. Updating the access policy only affects pending and future endpoint gateway
// bindings.
// - permit: access will be permitted
// - deny: access will be denied
// - review: access will be manually reviewed
//
// - Updating to `review` sets the status of future endpoint gateway bindings from
// this account to `pending`.
// - Updating to `permit` updates both the status of any `pending` and future endpoint
// gateway bindings from this account to `permitted`.
// - Updating to `deny` updates both the status of any `pending` and future endpoint
// gateway bindings from this account to `denied`.
AccessPolicy *string `json:"access_policy,omitempty"`
}
// Constants associated with the PrivatePathServiceGatewayAccountPolicyPatch.AccessPolicy property.
// The access policy for the account. Updating the access policy only affects pending and future endpoint gateway
// bindings.
// - permit: access will be permitted
// - deny: access will be denied
// - review: access will be manually reviewed
//
// - Updating to `review` sets the status of future endpoint gateway bindings from
// this account to `pending`.
// - Updating to `permit` updates both the status of any `pending` and future endpoint
// gateway bindings from this account to `permitted`.
// - Updating to `deny` updates both the status of any `pending` and future endpoint
// gateway bindings from this account to `denied`.
const (
PrivatePathServiceGatewayAccountPolicyPatchAccessPolicyDenyConst = "deny"
PrivatePathServiceGatewayAccountPolicyPatchAccessPolicyPermitConst = "permit"
PrivatePathServiceGatewayAccountPolicyPatchAccessPolicyReviewConst = "review"
)
// UnmarshalPrivatePathServiceGatewayAccountPolicyPatch unmarshals an instance of PrivatePathServiceGatewayAccountPolicyPatch from the specified map of raw messages.
func UnmarshalPrivatePathServiceGatewayAccountPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PrivatePathServiceGatewayAccountPolicyPatch)
err = core.UnmarshalPrimitive(m, "access_policy", &obj.AccessPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "access_policy-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the PrivatePathServiceGatewayAccountPolicyPatch
func (privatePathServiceGatewayAccountPolicyPatch *PrivatePathServiceGatewayAccountPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(privatePathServiceGatewayAccountPolicyPatch.AccessPolicy) {
_patch["access_policy"] = privatePathServiceGatewayAccountPolicyPatch.AccessPolicy
}
return
}
// PrivatePathServiceGatewayCollection : PrivatePathServiceGatewayCollection struct
type PrivatePathServiceGatewayCollection struct {
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of private path service gateways.
PrivatePathServiceGateways []PrivatePathServiceGateway `json:"private_path_service_gateways" validate:"required"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalPrivatePathServiceGatewayCollection unmarshals an instance of PrivatePathServiceGatewayCollection from the specified map of raw messages.
func UnmarshalPrivatePathServiceGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PrivatePathServiceGatewayCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "private_path_service_gateways", &obj.PrivatePathServiceGateways, UnmarshalPrivatePathServiceGateway)
if err != nil {
err = core.SDKErrorf(err, "", "private_path_service_gateways-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *PrivatePathServiceGatewayCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// PrivatePathServiceGatewayEndpointGatewayBinding : PrivatePathServiceGatewayEndpointGatewayBinding struct
type PrivatePathServiceGatewayEndpointGatewayBinding struct {
// The account that created the endpoint gateway.
Account *AccountReference `json:"account" validate:"required"`
// The date and time that the endpoint gateway binding was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The expiration date and time for the endpoint gateway binding. At binding creation, this property will be set to 14
// days after the creation time, and will remain while the `status` of the binding is `pending`. If the date and time
// are reached while the binding is still `pending`, the binding will transition to `expired`.
//
// This property will be present if the `status` is `pending` or `expired`.
ExpirationAt *strfmt.DateTime `json:"expiration_at,omitempty"`
// The URL for this endpoint gateway binding.
Href *string `json:"href" validate:"required"`
// The unique identifier for this endpoint gateway binding.
ID *string `json:"id" validate:"required"`
// The lifecycle state of the endpoint gateway binding.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The status of the endpoint gateway binding:
// - `abandoned`: endpoint gateway binding is inactive, awaiting deletion.
// - `denied`: endpoint gateway binding was denied
// - `expired`: endpoint gateway binding has expired
// - `pending`: endpoint gateway binding is awaiting review
// - `permitted`: endpoint gateway binding was permitted
//
// An endpoint gateway binding will be automatically deleted when its associated endpoint gateway is deleted.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
}
// Constants associated with the PrivatePathServiceGatewayEndpointGatewayBinding.LifecycleState property.
// The lifecycle state of the endpoint gateway binding.
const (
PrivatePathServiceGatewayEndpointGatewayBindingLifecycleStateDeletingConst = "deleting"
PrivatePathServiceGatewayEndpointGatewayBindingLifecycleStateFailedConst = "failed"
PrivatePathServiceGatewayEndpointGatewayBindingLifecycleStatePendingConst = "pending"
PrivatePathServiceGatewayEndpointGatewayBindingLifecycleStateStableConst = "stable"
PrivatePathServiceGatewayEndpointGatewayBindingLifecycleStateSuspendedConst = "suspended"
PrivatePathServiceGatewayEndpointGatewayBindingLifecycleStateUpdatingConst = "updating"
PrivatePathServiceGatewayEndpointGatewayBindingLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the PrivatePathServiceGatewayEndpointGatewayBinding.ResourceType property.
// The resource type.
const (
PrivatePathServiceGatewayEndpointGatewayBindingResourceTypePrivatePathServiceGatewayEndpointGatewayBindingConst = "private_path_service_gateway_endpoint_gateway_binding"
)
// Constants associated with the PrivatePathServiceGatewayEndpointGatewayBinding.Status property.
// The status of the endpoint gateway binding:
// - `abandoned`: endpoint gateway binding is inactive, awaiting deletion.
// - `denied`: endpoint gateway binding was denied
// - `expired`: endpoint gateway binding has expired
// - `pending`: endpoint gateway binding is awaiting review
// - `permitted`: endpoint gateway binding was permitted
//
// An endpoint gateway binding will be automatically deleted when its associated endpoint gateway is deleted.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
PrivatePathServiceGatewayEndpointGatewayBindingStatusAbandonedConst = "abandoned"
PrivatePathServiceGatewayEndpointGatewayBindingStatusDeniedConst = "denied"
PrivatePathServiceGatewayEndpointGatewayBindingStatusExpiredConst = "expired"
PrivatePathServiceGatewayEndpointGatewayBindingStatusPendingConst = "pending"
PrivatePathServiceGatewayEndpointGatewayBindingStatusPermittedConst = "permitted"
)
// UnmarshalPrivatePathServiceGatewayEndpointGatewayBinding unmarshals an instance of PrivatePathServiceGatewayEndpointGatewayBinding from the specified map of raw messages.
func UnmarshalPrivatePathServiceGatewayEndpointGatewayBinding(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PrivatePathServiceGatewayEndpointGatewayBinding)
err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference)
if err != nil {
err = core.SDKErrorf(err, "", "account-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "expiration_at", &obj.ExpirationAt)
if err != nil {
err = core.SDKErrorf(err, "", "expiration_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// PrivatePathServiceGatewayEndpointGatewayBindingCollection : PrivatePathServiceGatewayEndpointGatewayBindingCollection struct
type PrivatePathServiceGatewayEndpointGatewayBindingCollection struct {
// A page of endpoint gateway bindings for the private path service gateway.
EndpointGatewayBindings []PrivatePathServiceGatewayEndpointGatewayBinding `json:"endpoint_gateway_bindings" validate:"required"`
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollection unmarshals an instance of PrivatePathServiceGatewayEndpointGatewayBindingCollection from the specified map of raw messages.
func UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PrivatePathServiceGatewayEndpointGatewayBindingCollection)
err = core.UnmarshalModel(m, "endpoint_gateway_bindings", &obj.EndpointGatewayBindings, UnmarshalPrivatePathServiceGatewayEndpointGatewayBinding)
if err != nil {
err = core.SDKErrorf(err, "", "endpoint_gateway_bindings-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *PrivatePathServiceGatewayEndpointGatewayBindingCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// PrivatePathServiceGatewayPatch : PrivatePathServiceGatewayPatch struct
type PrivatePathServiceGatewayPatch struct {
// The policy to use for bindings from accounts without an explicit account policy.
DefaultAccessPolicy *string `json:"default_access_policy,omitempty"`
// The load balancer for this private path service gateway. The load balancer must
// have `is_private_path` set to `true`, and must be in the same VPC as the private
// path service gateway.
LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"`
// The name for this private path service gateway. The name must not be used by another private path service gateway in
// the VPC.
Name *string `json:"name,omitempty"`
// Indicates whether this private path service gateway has zonal affinity.
//
// Updating the value of `zonal_affinity` changes how traffic for existing and future endpoint gateway bindings will be
// routed:
// - `true`: Traffic to the service from a zone the service resides in will remain in
// that zone.
// - `false`: Traffic to the service from a zone will be load balanced across all zones
// in the region the service resides in.
ZonalAffinity *bool `json:"zonal_affinity,omitempty"`
}
// Constants associated with the PrivatePathServiceGatewayPatch.DefaultAccessPolicy property.
// The policy to use for bindings from accounts without an explicit account policy.
const (
PrivatePathServiceGatewayPatchDefaultAccessPolicyDenyConst = "deny"
PrivatePathServiceGatewayPatchDefaultAccessPolicyPermitConst = "permit"
PrivatePathServiceGatewayPatchDefaultAccessPolicyReviewConst = "review"
)
// UnmarshalPrivatePathServiceGatewayPatch unmarshals an instance of PrivatePathServiceGatewayPatch from the specified map of raw messages.
func UnmarshalPrivatePathServiceGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PrivatePathServiceGatewayPatch)
err = core.UnmarshalPrimitive(m, "default_access_policy", &obj.DefaultAccessPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "default_access_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "load_balancer", &obj.LoadBalancer, UnmarshalLoadBalancerIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "load_balancer-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "zonal_affinity", &obj.ZonalAffinity)
if err != nil {
err = core.SDKErrorf(err, "", "zonal_affinity-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the PrivatePathServiceGatewayPatch
func (privatePathServiceGatewayPatch *PrivatePathServiceGatewayPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(privatePathServiceGatewayPatch.DefaultAccessPolicy) {
_patch["default_access_policy"] = privatePathServiceGatewayPatch.DefaultAccessPolicy
}
if !core.IsNil(privatePathServiceGatewayPatch.LoadBalancer) {
_patch["load_balancer"] = privatePathServiceGatewayPatch.LoadBalancer.asPatch()
}
if !core.IsNil(privatePathServiceGatewayPatch.Name) {
_patch["name"] = privatePathServiceGatewayPatch.Name
}
if !core.IsNil(privatePathServiceGatewayPatch.ZonalAffinity) {
_patch["zonal_affinity"] = privatePathServiceGatewayPatch.ZonalAffinity
}
return
}
// PrivatePathServiceGatewayRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not
// be directly retrievable.
type PrivatePathServiceGatewayRemote struct {
// If present, this property indicates that the referenced resource is remote to this
// account, and identifies the owning account.
Account *AccountReference `json:"account,omitempty"`
// If present, this property indicates that the referenced resource is remote to this
// region, and identifies the native region.
Region *RegionReference `json:"region,omitempty"`
}
// UnmarshalPrivatePathServiceGatewayRemote unmarshals an instance of PrivatePathServiceGatewayRemote from the specified map of raw messages.
func UnmarshalPrivatePathServiceGatewayRemote(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PrivatePathServiceGatewayRemote)
err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference)
if err != nil {
err = core.SDKErrorf(err, "", "account-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference)
if err != nil {
err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// PublicAddressRange : PublicAddressRange struct
type PublicAddressRange struct {
// The public IPv4 range, expressed in CIDR format.
CIDR *string `json:"cidr" validate:"required"`
// The date and time that the public address range was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The CRN for this public address range.
CRN *string `json:"crn" validate:"required"`
// The URL for this public address range.
Href *string `json:"href" validate:"required"`
// The unique identifier for this public address range.
ID *string `json:"id" validate:"required"`
// The number of IPv4 addresses in this public address range.
Ipv4AddressCount *int64 `json:"ipv4_address_count" validate:"required"`
// The lifecycle state of the public address range.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The name for this public address range. The name is unique across all public address ranges in the region.
Name *string `json:"name" validate:"required"`
// The resource group for this public address range.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The target this public address range is bound to.
//
// If absent, this pubic address range is not bound to a target.
//
// The target resources supported by this property is expected to
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Future
// targets may omit the `vpc` property.
Target *PublicAddressRangeTarget `json:"target,omitempty"`
}
// Constants associated with the PublicAddressRange.LifecycleState property.
// The lifecycle state of the public address range.
const (
PublicAddressRangeLifecycleStateDeletingConst = "deleting"
PublicAddressRangeLifecycleStateFailedConst = "failed"
PublicAddressRangeLifecycleStatePendingConst = "pending"
PublicAddressRangeLifecycleStateStableConst = "stable"
PublicAddressRangeLifecycleStateSuspendedConst = "suspended"
PublicAddressRangeLifecycleStateUpdatingConst = "updating"
PublicAddressRangeLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the PublicAddressRange.ResourceType property.
// The resource type.
const (
PublicAddressRangeResourceTypePublicAddressRangeConst = "public_address_range"
)
// UnmarshalPublicAddressRange unmarshals an instance of PublicAddressRange from the specified map of raw messages.
func UnmarshalPublicAddressRange(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PublicAddressRange)
err = core.UnmarshalPrimitive(m, "cidr", &obj.CIDR)
if err != nil {
err = core.SDKErrorf(err, "", "cidr-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "ipv4_address_count", &obj.Ipv4AddressCount)
if err != nil {
err = core.SDKErrorf(err, "", "ipv4_address_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalPublicAddressRangeTarget)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// PublicAddressRangeCollection : PublicAddressRangeCollection struct
type PublicAddressRangeCollection struct {
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of public address ranges.
PublicAddressRanges []PublicAddressRange `json:"public_address_ranges" validate:"required"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalPublicAddressRangeCollection unmarshals an instance of PublicAddressRangeCollection from the specified map of raw messages.
func UnmarshalPublicAddressRangeCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PublicAddressRangeCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "public_address_ranges", &obj.PublicAddressRanges, UnmarshalPublicAddressRange)
if err != nil {
err = core.SDKErrorf(err, "", "public_address_ranges-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *PublicAddressRangeCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// PublicAddressRangePatch : PublicAddressRangePatch struct
type PublicAddressRangePatch struct {
// The name for this public address range. The name must not be used by another public address range in the region.
Name *string `json:"name,omitempty"`
// The target to bind this public address range to.
//
// If the public address range is not currently bound to a target, both `target.vpc` and
// `target.zone` must be specified.
//
// Specify `null` to unbind the public address range from any existing target.
Target *PublicAddressRangeTargetPatch `json:"target,omitempty"`
}
// UnmarshalPublicAddressRangePatch unmarshals an instance of PublicAddressRangePatch from the specified map of raw messages.
func UnmarshalPublicAddressRangePatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PublicAddressRangePatch)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalPublicAddressRangeTargetPatch)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the PublicAddressRangePatch
func (publicAddressRangePatch *PublicAddressRangePatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(publicAddressRangePatch.Name) {
_patch["name"] = publicAddressRangePatch.Name
}
if !core.IsNil(publicAddressRangePatch.Target) {
_patch["target"] = publicAddressRangePatch.Target.asPatch()
}
return
}
// PublicAddressRangeReference : PublicAddressRangeReference struct
type PublicAddressRangeReference struct {
// The CRN for this public address range.
CRN *string `json:"crn" validate:"required"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this public address range.
Href *string `json:"href" validate:"required"`
// The unique identifier for this public address range.
ID *string `json:"id" validate:"required"`
// The name for this public address range. The name is unique across all public address ranges in the region.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the PublicAddressRangeReference.ResourceType property.
// The resource type.
const (
PublicAddressRangeReferenceResourceTypePublicAddressRangeConst = "public_address_range"
)
// UnmarshalPublicAddressRangeReference unmarshals an instance of PublicAddressRangeReference from the specified map of raw messages.
func UnmarshalPublicAddressRangeReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PublicAddressRangeReference)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// PublicAddressRangeTarget : The target this public address range is bound to.
//
// If absent, this pubic address range is not bound to a target.
//
// The target resources supported by this property is expected to
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Future targets may omit the `vpc`
// property.
type PublicAddressRangeTarget struct {
// The VPC this public address range is bound to.
VPC *VPCReference `json:"vpc,omitempty"`
// The zone this public address range resides in.
Zone *ZoneReference `json:"zone" validate:"required"`
}
// UnmarshalPublicAddressRangeTarget unmarshals an instance of PublicAddressRangeTarget from the specified map of raw messages.
func UnmarshalPublicAddressRangeTarget(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PublicAddressRangeTarget)
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// PublicAddressRangeTargetPatch : The target to bind this public address range to.
//
// If the public address range is not currently bound to a target, both `target.vpc` and
// `target.zone` must be specified.
//
// Specify `null` to unbind the public address range from any existing target.
type PublicAddressRangeTargetPatch struct {
// The VPC to bind this public address range to, replacing any existing VPC.
VPC VPCIdentityIntf `json:"vpc,omitempty"`
// The zone this public address range will reside in, replacing any existing zone.
Zone ZoneIdentityIntf `json:"zone,omitempty"`
}
// UnmarshalPublicAddressRangeTargetPatch unmarshals an instance of PublicAddressRangeTargetPatch from the specified map of raw messages.
func UnmarshalPublicAddressRangeTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PublicAddressRangeTargetPatch)
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the PublicAddressRangeTargetPatch
func (publicAddressRangeTargetPatch *PublicAddressRangeTargetPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(publicAddressRangeTargetPatch.VPC) {
_patch["vpc"] = publicAddressRangeTargetPatch.VPC.asPatch()
}
if !core.IsNil(publicAddressRangeTargetPatch.Zone) {
_patch["zone"] = publicAddressRangeTargetPatch.Zone.asPatch()
}
return
}
// PublicAddressRangeTargetPrototype : The target to bind this public address range to. If unspecified, the public address range will not be bound to a
// target at creation.
type PublicAddressRangeTargetPrototype struct {
// The VPC to bind this public address range to.
VPC VPCIdentityIntf `json:"vpc" validate:"required"`
// The zone this public address range will reside in.
Zone ZoneIdentityIntf `json:"zone" validate:"required"`
}
// NewPublicAddressRangeTargetPrototype : Instantiate PublicAddressRangeTargetPrototype (Generic Model Constructor)
func (*VpcV1) NewPublicAddressRangeTargetPrototype(vpc VPCIdentityIntf, zone ZoneIdentityIntf) (_model *PublicAddressRangeTargetPrototype, err error) {
_model = &PublicAddressRangeTargetPrototype{
VPC: vpc,
Zone: zone,
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalPublicAddressRangeTargetPrototype unmarshals an instance of PublicAddressRangeTargetPrototype from the specified map of raw messages.
func UnmarshalPublicAddressRangeTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(PublicAddressRangeTargetPrototype)
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
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"`
// The floating IP 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 name for this public gateway. The name is unique across all public gateways in the VPC.
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 this public gateway.
Status *string `json:"status" validate:"required"`
// The VPC this public gateway resides in.
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 this public gateway.
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 {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "floating_ip", &obj.FloatingIP, UnmarshalPublicGatewayFloatingIP)
if err != nil {
err = core.SDKErrorf(err, "", "floating_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
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 *PageLink `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 *PageLink `json:"next,omitempty"`
// A page 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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "public_gateways", &obj.PublicGateways, UnmarshalPublicGateway)
if err != nil {
err = core.SDKErrorf(err, "", "public_gateways-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *PublicGatewayCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// PublicGatewayFloatingIP : The floating IP 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 *Deleted `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 name for this floating IP. The name is unique across all floating IPs in the region.
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 {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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 name for this floating IP. The name must not be used by another floating IP in the region. 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) will be 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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// PublicGatewayIdentity : Identifies a public gateway by a unique property.
// Models which "extend" this model:
// - PublicGatewayIdentityPublicGatewayIdentityByID
// - PublicGatewayIdentityPublicGatewayIdentityByCRN
// - PublicGatewayIdentityPublicGatewayIdentityByHref
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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// PublicGatewayPatch : PublicGatewayPatch struct
type PublicGatewayPatch struct {
// The name for this public gateway. The name must not be used by another public gateway in the VPC.
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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(publicGatewayPatch.Name) {
_patch["name"] = publicGatewayPatch.Name
}
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 *Deleted `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 name for this public gateway. The name is unique across all public gateways in the VPC.
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 {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// PublishPrivatePathServiceGatewayOptions : The PublishPrivatePathServiceGateway options.
type PublishPrivatePathServiceGatewayOptions struct {
// The private path service gateway identifier.
PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewPublishPrivatePathServiceGatewayOptions : Instantiate PublishPrivatePathServiceGatewayOptions
func (*VpcV1) NewPublishPrivatePathServiceGatewayOptions(privatePathServiceGatewayID string) *PublishPrivatePathServiceGatewayOptions {
return &PublishPrivatePathServiceGatewayOptions{
PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID),
}
}
// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID
func (_options *PublishPrivatePathServiceGatewayOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *PublishPrivatePathServiceGatewayOptions {
_options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *PublishPrivatePathServiceGatewayOptions) SetHeaders(param map[string]string) *PublishPrivatePathServiceGatewayOptions {
options.Headers = param
return options
}
// 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.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
}
// Constants associated with the Region.Status property.
// The availability status of this region.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 {
err = core.SDKErrorf(err, "", "endpoint-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// RegionCollection : RegionCollection struct
type RegionCollection struct {
// The regions for the account.
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 {
err = core.SDKErrorf(err, "", "regions-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// RegionIdentity : Identifies a region by a unique property.
// Models which "extend" this model:
// - RegionIdentityByName
// - RegionIdentityByHref
type RegionIdentity struct {
// The globally unique name for this region.
Name *string `json:"name,omitempty"`
// The URL for this region.
Href *string `json:"href,omitempty"`
}
func (*RegionIdentity) isaRegionIdentity() bool {
return true
}
type RegionIdentityIntf interface {
isaRegionIdentity() bool
asPatch() map[string]interface{}
}
// UnmarshalRegionIdentity unmarshals an instance of RegionIdentity from the specified map of raw messages.
func UnmarshalRegionIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(RegionIdentity)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the RegionIdentity
func (regionIdentity *RegionIdentity) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(regionIdentity.Name) {
_patch["name"] = regionIdentity.Name
}
if !core.IsNil(regionIdentity.Href) {
_patch["href"] = regionIdentity.Href
}
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 {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// RemoveBareMetalServerNetworkInterfaceFloatingIPOptions : The RemoveBareMetalServerNetworkInterfaceFloatingIP options.
type RemoveBareMetalServerNetworkInterfaceFloatingIPOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// The bare metal server network interface identifier.
NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="`
// The floating IP identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate RemoveBareMetalServerNetworkInterfaceFloatingIPOptions
func (*VpcV1) NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions {
return &RemoveBareMetalServerNetworkInterfaceFloatingIPOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
NetworkInterfaceID: core.StringPtr(networkInterfaceID),
ID: core.StringPtr(id),
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID
func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions {
_options.NetworkInterfaceID = core.StringPtr(networkInterfaceID)
return _options
}
// SetID : Allow user to set ID
func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions {
options.Headers = param
return options
}
// RemoveEndpointGatewayIPOptions : The RemoveEndpointGatewayIP options.
type RemoveEndpointGatewayIPOptions struct {
// The endpoint gateway identifier.
EndpointGatewayID *string `json:"endpoint_gateway_id" validate:"required,ne="`
// The reserved IP identifier.
ID *string `json:"id" 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 virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance network interface identifier.
NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="`
// The floating IP identifier.
ID *string `json:"id" 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
}
// RemoveNetworkInterfaceFloatingIPOptions : The RemoveNetworkInterfaceFloatingIP options.
type RemoveNetworkInterfaceFloatingIPOptions struct {
// The virtual network interface identifier.
VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="`
// The floating IP identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewRemoveNetworkInterfaceFloatingIPOptions : Instantiate RemoveNetworkInterfaceFloatingIPOptions
func (*VpcV1) NewRemoveNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *RemoveNetworkInterfaceFloatingIPOptions {
return &RemoveNetworkInterfaceFloatingIPOptions{
VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID),
ID: core.StringPtr(id),
}
}
// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID
func (_options *RemoveNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *RemoveNetworkInterfaceFloatingIPOptions {
_options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID)
return _options
}
// SetID : Allow user to set ID
func (_options *RemoveNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveNetworkInterfaceFloatingIPOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *RemoveNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveNetworkInterfaceFloatingIPOptions {
options.Headers = param
return options
}
// RemoveVirtualNetworkInterfaceIPOptions : The RemoveVirtualNetworkInterfaceIP options.
type RemoveVirtualNetworkInterfaceIPOptions struct {
// The virtual network interface identifier.
VirtualNetworkInterfaceID *string `json:"virtual_network_interface_id" validate:"required,ne="`
// The reserved IP identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewRemoveVirtualNetworkInterfaceIPOptions : Instantiate RemoveVirtualNetworkInterfaceIPOptions
func (*VpcV1) NewRemoveVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *RemoveVirtualNetworkInterfaceIPOptions {
return &RemoveVirtualNetworkInterfaceIPOptions{
VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID),
ID: core.StringPtr(id),
}
}
// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID
func (_options *RemoveVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *RemoveVirtualNetworkInterfaceIPOptions {
_options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID)
return _options
}
// SetID : Allow user to set ID
func (_options *RemoveVirtualNetworkInterfaceIPOptions) SetID(id string) *RemoveVirtualNetworkInterfaceIPOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *RemoveVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *RemoveVirtualNetworkInterfaceIPOptions {
options.Headers = param
return options
}
// RemoveVPNGatewayConnectionsLocalCIDROptions : The RemoveVPNGatewayConnectionsLocalCIDR options.
type RemoveVPNGatewayConnectionsLocalCIDROptions struct {
// The VPN gateway identifier.
VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="`
// The VPN gateway connection identifier.
ID *string `json:"id" validate:"required,ne="`
// The IP address range in CIDR block notation.
CIDR *string `json:"cidr" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewRemoveVPNGatewayConnectionsLocalCIDROptions : Instantiate RemoveVPNGatewayConnectionsLocalCIDROptions
func (*VpcV1) NewRemoveVPNGatewayConnectionsLocalCIDROptions(vpnGatewayID string, id string, cidr string) *RemoveVPNGatewayConnectionsLocalCIDROptions {
return &RemoveVPNGatewayConnectionsLocalCIDROptions{
VPNGatewayID: core.StringPtr(vpnGatewayID),
ID: core.StringPtr(id),
CIDR: core.StringPtr(cidr),
}
}
// SetVPNGatewayID : Allow user to set VPNGatewayID
func (_options *RemoveVPNGatewayConnectionsLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionsLocalCIDROptions {
_options.VPNGatewayID = core.StringPtr(vpnGatewayID)
return _options
}
// SetID : Allow user to set ID
func (_options *RemoveVPNGatewayConnectionsLocalCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionsLocalCIDROptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetCIDR : Allow user to set CIDR
func (_options *RemoveVPNGatewayConnectionsLocalCIDROptions) SetCIDR(cidr string) *RemoveVPNGatewayConnectionsLocalCIDROptions {
_options.CIDR = core.StringPtr(cidr)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *RemoveVPNGatewayConnectionsLocalCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionsLocalCIDROptions {
options.Headers = param
return options
}
// RemoveVPNGatewayConnectionsPeerCIDROptions : The RemoveVPNGatewayConnectionsPeerCIDR options.
type RemoveVPNGatewayConnectionsPeerCIDROptions struct {
// The VPN gateway identifier.
VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="`
// The VPN gateway connection identifier.
ID *string `json:"id" validate:"required,ne="`
// The IP address range in CIDR block notation.
CIDR *string `json:"cidr" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewRemoveVPNGatewayConnectionsPeerCIDROptions : Instantiate RemoveVPNGatewayConnectionsPeerCIDROptions
func (*VpcV1) NewRemoveVPNGatewayConnectionsPeerCIDROptions(vpnGatewayID string, id string, cidr string) *RemoveVPNGatewayConnectionsPeerCIDROptions {
return &RemoveVPNGatewayConnectionsPeerCIDROptions{
VPNGatewayID: core.StringPtr(vpnGatewayID),
ID: core.StringPtr(id),
CIDR: core.StringPtr(cidr),
}
}
// SetVPNGatewayID : Allow user to set VPNGatewayID
func (_options *RemoveVPNGatewayConnectionsPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionsPeerCIDROptions {
_options.VPNGatewayID = core.StringPtr(vpnGatewayID)
return _options
}
// SetID : Allow user to set ID
func (_options *RemoveVPNGatewayConnectionsPeerCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionsPeerCIDROptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetCIDR : Allow user to set CIDR
func (_options *RemoveVPNGatewayConnectionsPeerCIDROptions) SetCIDR(cidr string) *RemoveVPNGatewayConnectionsPeerCIDROptions {
_options.CIDR = core.StringPtr(cidr)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *RemoveVPNGatewayConnectionsPeerCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionsPeerCIDROptions {
options.Headers = param
return options
}
// ReplaceBareMetalServerInitializationOptions : The ReplaceBareMetalServerInitialization options.
type ReplaceBareMetalServerInitializationOptions struct {
// The bare metal server identifier.
ID *string `json:"id" validate:"required,ne="`
// The image to be used when provisioning the bare metal server.
Image ImageIdentityIntf `json:"image" validate:"required"`
// The public SSH keys to install on the bare metal server. Keys will be made available to the bare metal server as
// cloud-init vendor data. For cloud-init enabled images, these keys will also be added as SSH authorized keys for the
// [default user](https://cloud.ibm.com/docs/vpc?topic=vpc-vsi_is_connecting_linux#determining-default-user-account).
//
// For Windows images, at least one key must be specified, and one will be selected to encrypt the administrator
// password. Keys are optional for other images, but if no keys are specified, the bare metal server will be
// inaccessible unless the specified image provides another means of access.
Keys []KeyIdentityIntf `json:"keys" validate:"required"`
// The user data to be made available when initializing the bare metal server.
UserData *string `json:"user_data,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewReplaceBareMetalServerInitializationOptions : Instantiate ReplaceBareMetalServerInitializationOptions
func (*VpcV1) NewReplaceBareMetalServerInitializationOptions(id string, image ImageIdentityIntf, keys []KeyIdentityIntf) *ReplaceBareMetalServerInitializationOptions {
return &ReplaceBareMetalServerInitializationOptions{
ID: core.StringPtr(id),
Image: image,
Keys: keys,
}
}
// SetID : Allow user to set ID
func (_options *ReplaceBareMetalServerInitializationOptions) SetID(id string) *ReplaceBareMetalServerInitializationOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetImage : Allow user to set Image
func (_options *ReplaceBareMetalServerInitializationOptions) SetImage(image ImageIdentityIntf) *ReplaceBareMetalServerInitializationOptions {
_options.Image = image
return _options
}
// SetKeys : Allow user to set Keys
func (_options *ReplaceBareMetalServerInitializationOptions) SetKeys(keys []KeyIdentityIntf) *ReplaceBareMetalServerInitializationOptions {
_options.Keys = keys
return _options
}
// SetUserData : Allow user to set UserData
func (_options *ReplaceBareMetalServerInitializationOptions) SetUserData(userData string) *ReplaceBareMetalServerInitializationOptions {
_options.UserData = core.StringPtr(userData)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *ReplaceBareMetalServerInitializationOptions) SetHeaders(param map[string]string) *ReplaceBareMetalServerInitializationOptions {
options.Headers = param
return options
}
// ReplaceLoadBalancerPoolMembersOptions : The ReplaceLoadBalancerPoolMembers options.
type ReplaceLoadBalancerPoolMembersOptions struct {
// The load balancer identifier.
LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="`
// The pool identifier.
PoolID *string `json:"pool_id" validate:"required,ne="`
// The member prototype objects for this pool.
Members []LoadBalancerPoolMemberPrototype `json:"members" 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 `json:"id" validate:"required,ne="`
// The network ACL identity.
NetworkACLIdentity NetworkACLIdentityIntf `json:"NetworkACLIdentity" 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 `json:"id" validate:"required,ne="`
// The routing table identity.
RoutingTableIdentity RoutingTableIdentityIntf `json:"RoutingTableIdentity" 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
}
// Reservation : Reservation struct
type Reservation struct {
// The affinity policy to use for this reservation:
// - `automatic`: The reservation will be automatically selected
// - `restricted`: The reservation must be manually requested
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
AffinityPolicy *string `json:"affinity_policy" validate:"required"`
// The capacity configuration for this reservation
//
// If absent, this reservation has no assigned capacity.
Capacity *ReservationCapacity `json:"capacity,omitempty"`
// The committed use configuration for this reservation.
//
// If absent, this reservation has no commitment for use.
CommittedUse *ReservationCommittedUse `json:"committed_use,omitempty"`
// The date and time that the reservation was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The CRN for this reservation.
CRN *string `json:"crn" validate:"required"`
// The URL for this reservation.
Href *string `json:"href" validate:"required"`
// The unique identifier for this reservation.
ID *string `json:"id" validate:"required"`
// The lifecycle state of this reservation.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The name for this reservation. The name is unique across all reservations in the region.
Name *string `json:"name" validate:"required"`
// The [instance profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) or
// [bare metal server
// profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile)
// for this reservation.
Profile ReservationProfileIntf `json:"profile" validate:"required"`
// The resource group for this reservation.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The status of the reservation.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
// The reasons for the current status (if any).
StatusReasons []ReservationStatusReason `json:"status_reasons" validate:"required"`
// The zone for this reservation.
Zone *ZoneReference `json:"zone" validate:"required"`
}
// Constants associated with the Reservation.AffinityPolicy property.
// The affinity policy to use for this reservation:
// - `automatic`: The reservation will be automatically selected
// - `restricted`: The reservation must be manually requested
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ReservationAffinityPolicyAutomaticConst = "automatic"
ReservationAffinityPolicyRestrictedConst = "restricted"
)
// Constants associated with the Reservation.LifecycleState property.
// The lifecycle state of this reservation.
const (
ReservationLifecycleStateDeletingConst = "deleting"
ReservationLifecycleStateFailedConst = "failed"
ReservationLifecycleStatePendingConst = "pending"
ReservationLifecycleStateStableConst = "stable"
ReservationLifecycleStateSuspendedConst = "suspended"
ReservationLifecycleStateUpdatingConst = "updating"
ReservationLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the Reservation.ResourceType property.
// The resource type.
const (
ReservationResourceTypeReservationConst = "reservation"
)
// Constants associated with the Reservation.Status property.
// The status of the reservation.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ReservationStatusActivatingConst = "activating"
ReservationStatusActiveConst = "active"
ReservationStatusDeactivatingConst = "deactivating"
ReservationStatusExpiredConst = "expired"
ReservationStatusFailedConst = "failed"
ReservationStatusInactiveConst = "inactive"
)
// UnmarshalReservation unmarshals an instance of Reservation from the specified map of raw messages.
func UnmarshalReservation(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(Reservation)
err = core.UnmarshalPrimitive(m, "affinity_policy", &obj.AffinityPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "affinity_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalReservationCapacity)
if err != nil {
err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "committed_use", &obj.CommittedUse, UnmarshalReservationCommittedUse)
if err != nil {
err = core.SDKErrorf(err, "", "committed_use-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalReservationProfile)
if err != nil {
err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalReservationStatusReason)
if err != nil {
err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ReservationCapacity : The capacity configuration for this reservation
//
// If absent, this reservation has no assigned capacity.
type ReservationCapacity struct {
// The amount allocated to this capacity reservation.
Allocated *int64 `json:"allocated" validate:"required"`
// The amount of this capacity reservation available for new attachments.
Available *int64 `json:"available" validate:"required"`
// The status of the capacity reservation:
// - `allocating`: The capacity reservation is being allocated for use
// - `allocated`: The total capacity of the reservation has been allocated for use
// - `degraded`: The capacity reservation has been allocated for use, but some of the
// capacity is not available. See [capacity status
// reasons](https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons)
// for more information.
// - `unallocated`: The capacity reservation is not allocated for use
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
// The total amount of this capacity reservation.
Total *int64 `json:"total" validate:"required"`
// The amount of this capacity reservation used by existing attachments.
Used *int64 `json:"used" validate:"required"`
}
// Constants associated with the ReservationCapacity.Status property.
// The status of the capacity reservation:
// - `allocating`: The capacity reservation is being allocated for use
// - `allocated`: The total capacity of the reservation has been allocated for use
// - `degraded`: The capacity reservation has been allocated for use, but some of the
// capacity is not available. See [capacity status
// reasons](https://cloud.ibm.com/docs/vpc?topic=vpc-reserved-capacity-status-reasons)
// for more information.
// - `unallocated`: The capacity reservation is not allocated for use
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ReservationCapacityStatusAllocatedConst = "allocated"
ReservationCapacityStatusAllocatingConst = "allocating"
ReservationCapacityStatusDegradedConst = "degraded"
ReservationCapacityStatusUnallocatedConst = "unallocated"
)
// UnmarshalReservationCapacity unmarshals an instance of ReservationCapacity from the specified map of raw messages.
func UnmarshalReservationCapacity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ReservationCapacity)
err = core.UnmarshalPrimitive(m, "allocated", &obj.Allocated)
if err != nil {
err = core.SDKErrorf(err, "", "allocated-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "available", &obj.Available)
if err != nil {
err = core.SDKErrorf(err, "", "available-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total", &obj.Total)
if err != nil {
err = core.SDKErrorf(err, "", "total-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "used", &obj.Used)
if err != nil {
err = core.SDKErrorf(err, "", "used-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ReservationCapacityPatch : The capacity reservation configuration to use.
//
// The configuration can only be changed for reservations with a `status` of `inactive`.
type ReservationCapacityPatch struct {
// The total amount to use for this capacity reservation.
Total *int64 `json:"total,omitempty"`
}
// UnmarshalReservationCapacityPatch unmarshals an instance of ReservationCapacityPatch from the specified map of raw messages.
func UnmarshalReservationCapacityPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ReservationCapacityPatch)
err = core.UnmarshalPrimitive(m, "total", &obj.Total)
if err != nil {
err = core.SDKErrorf(err, "", "total-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the ReservationCapacityPatch
func (reservationCapacityPatch *ReservationCapacityPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(reservationCapacityPatch.Total) {
_patch["total"] = reservationCapacityPatch.Total
}
return
}
// ReservationCapacityPrototype : The capacity reservation configuration to use.
type ReservationCapacityPrototype struct {
// The total amount to use for this capacity reservation.
Total *int64 `json:"total" validate:"required"`
}
// NewReservationCapacityPrototype : Instantiate ReservationCapacityPrototype (Generic Model Constructor)
func (*VpcV1) NewReservationCapacityPrototype(total int64) (_model *ReservationCapacityPrototype, err error) {
_model = &ReservationCapacityPrototype{
Total: core.Int64Ptr(total),
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalReservationCapacityPrototype unmarshals an instance of ReservationCapacityPrototype from the specified map of raw messages.
func UnmarshalReservationCapacityPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ReservationCapacityPrototype)
err = core.UnmarshalPrimitive(m, "total", &obj.Total)
if err != nil {
err = core.SDKErrorf(err, "", "total-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ReservationCollection : ReservationCollection struct
type ReservationCollection struct {
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of reservations.
Reservations []Reservation `json:"reservations" validate:"required"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalReservationCollection unmarshals an instance of ReservationCollection from the specified map of raw messages.
func UnmarshalReservationCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ReservationCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "reservations", &obj.Reservations, UnmarshalReservation)
if err != nil {
err = core.SDKErrorf(err, "", "reservations-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ReservationCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ReservationCommittedUse : The committed use reservation configuration.
type ReservationCommittedUse struct {
// The expiration date and time for this committed use reservation.
//
// This property will be absent if the reservation has a `status` of `inactive`.
ExpirationAt *strfmt.DateTime `json:"expiration_at,omitempty"`
// The policy to apply when the committed use term expires:
// - `release`: Release any available capacity and let the reservation expire.
// - `renew`: Renew for another term, provided the term remains listed in the
// `reservation_terms` for the profile. Otherwise, let the reservation expire.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
ExpirationPolicy *string `json:"expiration_policy" validate:"required"`
// The term for this committed use reservation:
// - `one_year`: 1 year
// - `three_year`: 3 years
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Term *string `json:"term" validate:"required"`
}
// Constants associated with the ReservationCommittedUse.ExpirationPolicy property.
// The policy to apply when the committed use term expires:
// - `release`: Release any available capacity and let the reservation expire.
// - `renew`: Renew for another term, provided the term remains listed in the
// `reservation_terms` for the profile. Otherwise, let the reservation expire.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ReservationCommittedUseExpirationPolicyReleaseConst = "release"
ReservationCommittedUseExpirationPolicyRenewConst = "renew"
)
// UnmarshalReservationCommittedUse unmarshals an instance of ReservationCommittedUse from the specified map of raw messages.
func UnmarshalReservationCommittedUse(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ReservationCommittedUse)
err = core.UnmarshalPrimitive(m, "expiration_at", &obj.ExpirationAt)
if err != nil {
err = core.SDKErrorf(err, "", "expiration_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "expiration_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "term", &obj.Term)
if err != nil {
err = core.SDKErrorf(err, "", "term-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ReservationCommittedUsePatch : ReservationCommittedUsePatch struct
type ReservationCommittedUsePatch struct {
// The policy to apply when the committed use term expires:
// - `release`: Release any available capacity and let the reservation expire.
// - `renew`: Renew for another term, provided the term remains listed in the
// `reservation_terms` for the profile. Otherwise, let the reservation expire.
ExpirationPolicy *string `json:"expiration_policy,omitempty"`
// The term for this committed use reservation:
// - `one_year`: 1 year
// - `three_year`: 3 years
//
// The specified value must be listed in the `reservation_terms` in the profile for this reservation. The term can only
// be changed for a reservation with a `status` of
// `inactive`.
Term *string `json:"term,omitempty"`
}
// Constants associated with the ReservationCommittedUsePatch.ExpirationPolicy property.
// The policy to apply when the committed use term expires:
// - `release`: Release any available capacity and let the reservation expire.
// - `renew`: Renew for another term, provided the term remains listed in the
// `reservation_terms` for the profile. Otherwise, let the reservation expire.
const (
ReservationCommittedUsePatchExpirationPolicyReleaseConst = "release"
ReservationCommittedUsePatchExpirationPolicyRenewConst = "renew"
)
// UnmarshalReservationCommittedUsePatch unmarshals an instance of ReservationCommittedUsePatch from the specified map of raw messages.
func UnmarshalReservationCommittedUsePatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ReservationCommittedUsePatch)
err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "expiration_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "term", &obj.Term)
if err != nil {
err = core.SDKErrorf(err, "", "term-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the ReservationCommittedUsePatch
func (reservationCommittedUsePatch *ReservationCommittedUsePatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(reservationCommittedUsePatch.ExpirationPolicy) {
_patch["expiration_policy"] = reservationCommittedUsePatch.ExpirationPolicy
}
if !core.IsNil(reservationCommittedUsePatch.Term) {
_patch["term"] = reservationCommittedUsePatch.Term
}
return
}
// ReservationCommittedUsePrototype : ReservationCommittedUsePrototype struct
type ReservationCommittedUsePrototype struct {
// The policy to apply when the committed use term expires:
// - `release`: Release any available capacity and let the reservation expire.
// - `renew`: Renew for another term, provided the term remains listed in the
// `reservation_terms` for the profile. Otherwise, let the reservation expire.
ExpirationPolicy *string `json:"expiration_policy,omitempty"`
// The term for this committed use reservation:
// - `one_year`: 1 year
// - `three_year`: 3 years
//
// The specified value must be listed in the `reservation_terms` in the profile for this reservation.
Term *string `json:"term" validate:"required"`
}
// Constants associated with the ReservationCommittedUsePrototype.ExpirationPolicy property.
// The policy to apply when the committed use term expires:
// - `release`: Release any available capacity and let the reservation expire.
// - `renew`: Renew for another term, provided the term remains listed in the
// `reservation_terms` for the profile. Otherwise, let the reservation expire.
const (
ReservationCommittedUsePrototypeExpirationPolicyReleaseConst = "release"
ReservationCommittedUsePrototypeExpirationPolicyRenewConst = "renew"
)
// NewReservationCommittedUsePrototype : Instantiate ReservationCommittedUsePrototype (Generic Model Constructor)
func (*VpcV1) NewReservationCommittedUsePrototype(term string) (_model *ReservationCommittedUsePrototype, err error) {
_model = &ReservationCommittedUsePrototype{
Term: core.StringPtr(term),
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalReservationCommittedUsePrototype unmarshals an instance of ReservationCommittedUsePrototype from the specified map of raw messages.
func UnmarshalReservationCommittedUsePrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ReservationCommittedUsePrototype)
err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "expiration_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "term", &obj.Term)
if err != nil {
err = core.SDKErrorf(err, "", "term-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ReservationIdentity : Identifies a reservation by a unique property.
// Models which "extend" this model:
// - ReservationIdentityByID
// - ReservationIdentityByCRN
// - ReservationIdentityByHref
type ReservationIdentity struct {
// The unique identifier for this reservation.
ID *string `json:"id,omitempty"`
// The CRN for this reservation.
CRN *string `json:"crn,omitempty"`
// The URL for this reservation.
Href *string `json:"href,omitempty"`
}
func (*ReservationIdentity) isaReservationIdentity() bool {
return true
}
type ReservationIdentityIntf interface {
isaReservationIdentity() bool
asPatch() map[string]interface{}
}
// UnmarshalReservationIdentity unmarshals an instance of ReservationIdentity from the specified map of raw messages.
func UnmarshalReservationIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ReservationIdentity)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the ReservationIdentity
func (reservationIdentity *ReservationIdentity) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(reservationIdentity.ID) {
_patch["id"] = reservationIdentity.ID
}
if !core.IsNil(reservationIdentity.CRN) {
_patch["crn"] = reservationIdentity.CRN
}
if !core.IsNil(reservationIdentity.Href) {
_patch["href"] = reservationIdentity.Href
}
return
}
// ReservationPatch : ReservationPatch struct
type ReservationPatch struct {
// The affinity policy to use for this reservation:
// - `automatic`: The reservation will be automatically selected
// - `restricted`: The reservation must be manually requested
//
// The affinity policy can only be changed for a reservation with a `status` of `inactive`.
AffinityPolicy *string `json:"affinity_policy,omitempty"`
// The capacity reservation configuration to use.
//
// The configuration can only be changed for reservations with a `status` of `inactive`.
Capacity *ReservationCapacityPatch `json:"capacity,omitempty"`
// The committed use configuration to use for this reservation.
CommittedUse *ReservationCommittedUsePatch `json:"committed_use,omitempty"`
// The name for this reservation. The name must not be used by another reservation in the region.
Name *string `json:"name,omitempty"`
// The [instance profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) or
// [bare metal server
// profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile)
// to use for this reservation.
Profile *ReservationProfilePatch `json:"profile,omitempty"`
}
// Constants associated with the ReservationPatch.AffinityPolicy property.
// The affinity policy to use for this reservation:
// - `automatic`: The reservation will be automatically selected
// - `restricted`: The reservation must be manually requested
//
// The affinity policy can only be changed for a reservation with a `status` of `inactive`.
const (
ReservationPatchAffinityPolicyAutomaticConst = "automatic"
ReservationPatchAffinityPolicyRestrictedConst = "restricted"
)
// UnmarshalReservationPatch unmarshals an instance of ReservationPatch from the specified map of raw messages.
func UnmarshalReservationPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ReservationPatch)
err = core.UnmarshalPrimitive(m, "affinity_policy", &obj.AffinityPolicy)
if err != nil {
err = core.SDKErrorf(err, "", "affinity_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalReservationCapacityPatch)
if err != nil {
err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "committed_use", &obj.CommittedUse, UnmarshalReservationCommittedUsePatch)
if err != nil {
err = core.SDKErrorf(err, "", "committed_use-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalReservationProfilePatch)
if err != nil {
err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the ReservationPatch
func (reservationPatch *ReservationPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(reservationPatch.AffinityPolicy) {
_patch["affinity_policy"] = reservationPatch.AffinityPolicy
}
if !core.IsNil(reservationPatch.Capacity) {
_patch["capacity"] = reservationPatch.Capacity.asPatch()
}
if !core.IsNil(reservationPatch.CommittedUse) {
_patch["committed_use"] = reservationPatch.CommittedUse.asPatch()
}
if !core.IsNil(reservationPatch.Name) {
_patch["name"] = reservationPatch.Name
}
if !core.IsNil(reservationPatch.Profile) {
_patch["profile"] = reservationPatch.Profile.asPatch()
}
return
}
// ReservationProfile : The [instance profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) or
// [bare metal server profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) for this
// reservation.
// Models which "extend" this model:
// - ReservationProfileInstanceProfileReference
// - ReservationProfileBareMetalServerProfileReference
type ReservationProfile struct {
// The URL for this virtual server instance profile.
Href *string `json:"href,omitempty"`
// The globally unique name for this virtual server instance profile.
Name *string `json:"name,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type,omitempty"`
}
// Constants associated with the ReservationProfile.ResourceType property.
// The resource type.
const (
ReservationProfileResourceTypeInstanceProfileConst = "instance_profile"
)
func (*ReservationProfile) isaReservationProfile() bool {
return true
}
type ReservationProfileIntf interface {
isaReservationProfile() bool
}
// UnmarshalReservationProfile unmarshals an instance of ReservationProfile from the specified map of raw messages.
func UnmarshalReservationProfile(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ReservationProfile)
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ReservationProfilePatch : The [instance profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) or
// [bare metal server profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) to use for this
// reservation.
type ReservationProfilePatch struct {
// The globally unique name of the profile.
Name *string `json:"name,omitempty"`
// The resource type of the profile.
ResourceType *string `json:"resource_type,omitempty"`
}
// Constants associated with the ReservationProfilePatch.ResourceType property.
// The resource type of the profile.
const (
ReservationProfilePatchResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile"
ReservationProfilePatchResourceTypeInstanceProfileConst = "instance_profile"
)
// UnmarshalReservationProfilePatch unmarshals an instance of ReservationProfilePatch from the specified map of raw messages.
func UnmarshalReservationProfilePatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ReservationProfilePatch)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the ReservationProfilePatch
func (reservationProfilePatch *ReservationProfilePatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(reservationProfilePatch.Name) {
_patch["name"] = reservationProfilePatch.Name
}
if !core.IsNil(reservationProfilePatch.ResourceType) {
_patch["resource_type"] = reservationProfilePatch.ResourceType
}
return
}
// ReservationProfilePrototype : The [instance profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) or
// [bare metal server profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) to use for this
// reservation.
type ReservationProfilePrototype struct {
// The globally unique name of the profile.
Name *string `json:"name" validate:"required"`
// The resource type of the profile.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the ReservationProfilePrototype.ResourceType property.
// The resource type of the profile.
const (
ReservationProfilePrototypeResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile"
ReservationProfilePrototypeResourceTypeInstanceProfileConst = "instance_profile"
)
// NewReservationProfilePrototype : Instantiate ReservationProfilePrototype (Generic Model Constructor)
func (*VpcV1) NewReservationProfilePrototype(name string, resourceType string) (_model *ReservationProfilePrototype, err error) {
_model = &ReservationProfilePrototype{
Name: core.StringPtr(name),
ResourceType: core.StringPtr(resourceType),
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalReservationProfilePrototype unmarshals an instance of ReservationProfilePrototype from the specified map of raw messages.
func UnmarshalReservationProfilePrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ReservationProfilePrototype)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ReservationReference : ReservationReference struct
type ReservationReference struct {
// The CRN for this reservation.
CRN *string `json:"crn" validate:"required"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this reservation.
Href *string `json:"href" validate:"required"`
// The unique identifier for this reservation.
ID *string `json:"id" validate:"required"`
// The name for this reservation. The name is unique across all reservations in the region.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the ReservationReference.ResourceType property.
// The resource type.
const (
ReservationReferenceResourceTypeReservationConst = "reservation"
)
// UnmarshalReservationReference unmarshals an instance of ReservationReference from the specified map of raw messages.
func UnmarshalReservationReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ReservationReference)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ReservationStatusReason : ReservationStatusReason struct
type ReservationStatusReason struct {
// A snake case string succinctly identifying the status reason.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the status reason.
Message *string `json:"message" validate:"required"`
// A link to documentation about this status reason.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the ReservationStatusReason.Code property.
// A snake case string succinctly identifying the status reason.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ReservationStatusReasonCodeCannotActivateNoCapacityAvailableConst = "cannot_activate_no_capacity_available"
ReservationStatusReasonCodeCannotRenewUnsupportedProfileTermConst = "cannot_renew_unsupported_profile_term"
)
// UnmarshalReservationStatusReason unmarshals an instance of ReservationStatusReason from the specified map of raw messages.
func UnmarshalReservationStatusReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ReservationStatusReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ReservedIP : ReservedIP struct
type ReservedIP struct {
// The IP address.
//
// If the address has not yet been selected, the value will be `0.0.0.0`.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in
// the future.
Address *string `json:"address" validate:"required"`
// Indicates whether this reserved IP member will be automatically deleted when either
// `target` is deleted, or 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 lifecycle state of the reserved IP.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The name for this reserved IP. The name is unique across all reserved IPs in a subnet.
Name *string `json:"name" validate:"required"`
// The owner of the reserved IP.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Owner *string `json:"owner" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The target this reserved IP is bound to.
//
// If absent, this reserved IP is provider-owned or unbound.
//
// The resources supported by this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Target ReservedIPTargetIntf `json:"target,omitempty"`
}
// Constants associated with the ReservedIP.LifecycleState property.
// The lifecycle state of the reserved IP.
const (
ReservedIPLifecycleStateDeletingConst = "deleting"
ReservedIPLifecycleStateFailedConst = "failed"
ReservedIPLifecycleStatePendingConst = "pending"
ReservedIPLifecycleStateStableConst = "stable"
ReservedIPLifecycleStateSuspendedConst = "suspended"
ReservedIPLifecycleStateUpdatingConst = "updating"
ReservedIPLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the ReservedIP.Owner property.
// The owner of the reserved IP.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "owner", &obj.Owner)
if err != nil {
err = core.SDKErrorf(err, "", "owner-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalReservedIPTarget)
if err != nil {
err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo())
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 *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of reserved IPs in the 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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "reserved_ips", &obj.ReservedIps, UnmarshalReservedIP)
if err != nil {
err = core.SDKErrorf(err, "", "reserved_ips-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ReservedIPCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ReservedIPCollectionBareMetalServerNetworkInterfaceContext : ReservedIPCollectionBareMetalServerNetworkInterfaceContext struct
type ReservedIPCollectionBareMetalServerNetworkInterfaceContext struct {
// A link to the first page of resources.
First *PageLink `json:"first" validate:"required"`
// A page of reserved IPs bound to the bare metal server network interface.
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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext unmarshals an instance of ReservedIPCollectionBareMetalServerNetworkInterfaceContext from the specified map of raw messages.
func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ReservedIPCollectionBareMetalServerNetworkInterfaceContext)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP)
if err != nil {
err = core.SDKErrorf(err, "", "ips-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
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 *PageLink `json:"first" validate:"required"`
// A page of reserved IPs bound to the 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 *PageLink `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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP)
if err != nil {
err = core.SDKErrorf(err, "", "ips-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ReservedIPCollectionEndpointGatewayContext) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ReservedIPCollectionInstanceNetworkInterfaceContext : ReservedIPCollectionInstanceNetworkInterfaceContext struct
type ReservedIPCollectionInstanceNetworkInterfaceContext struct {
// A link to the first page of resources.
First *PageLink `json:"first" validate:"required"`
// A page of reserved IPs bound to the instance network interface.
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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext unmarshals an instance of ReservedIPCollectionInstanceNetworkInterfaceContext from the specified map of raw messages.
func UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ReservedIPCollectionInstanceNetworkInterfaceContext)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP)
if err != nil {
err = core.SDKErrorf(err, "", "ips-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ReservedIPCollectionInstanceNetworkInterfaceContext) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ReservedIPCollectionVirtualNetworkInterfaceContext : ReservedIPCollectionVirtualNetworkInterfaceContext struct
type ReservedIPCollectionVirtualNetworkInterfaceContext struct {
// A link to the first page of resources.
First *PageLink `json:"first" validate:"required"`
// A page of reserved IPs bound to the virtual network interface specified by the identifier in the URL.
Ips []ReservedIPReference `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext unmarshals an instance of ReservedIPCollectionVirtualNetworkInterfaceContext from the specified map of raw messages.
func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ReservedIPCollectionVirtualNetworkInterfaceContext)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "ips-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ReservedIPCollectionVirtualNetworkInterfaceContext) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ReservedIPPatch : ReservedIPPatch struct
type ReservedIPPatch struct {
// Indicates whether this reserved IP member will be automatically deleted when either
// `target` is deleted, or the reserved IP is unbound. Must be `false` if the reserved IP is unbound.
AutoDelete *bool `json:"auto_delete,omitempty"`
// The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with
// `ibm-` are reserved for provider-owned resources, and are not allowed.
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 {
err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(reservedIPPatch.AutoDelete) {
_patch["auto_delete"] = reservedIPPatch.AutoDelete
}
if !core.IsNil(reservedIPPatch.Name) {
_patch["name"] = reservedIPPatch.Name
}
return
}
// ReservedIPReference : ReservedIPReference struct
type ReservedIPReference struct {
// The IP address.
//
// If the address has not yet been selected, the value will be `0.0.0.0`.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in
// the future.
Address *string `json:"address" validate:"required"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `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 name for this reserved IP. The name is unique across all reserved IPs in a subnet.
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 {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ReservedIPTarget : The target this reserved IP is bound to.
//
// If absent, this reserved IP is provider-owned or unbound.
//
// The resources supported by this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
// Models which "extend" this model:
// - ReservedIPTargetEndpointGatewayReference
// - ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext
// - ReservedIPTargetNetworkInterfaceReferenceTargetContext
// - ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext
// - ReservedIPTargetLoadBalancerReference
// - ReservedIPTargetVPNGatewayReference
// - ReservedIPTargetVPNServerReference
// - ReservedIPTargetGenericResourceReference
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 *Deleted `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 name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC.
Name *string `json:"name,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type,omitempty"`
}
// Constants associated with the ReservedIPTarget.ResourceType property.
// The resource type.
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 {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ReservedIPTargetPrototype : The target to bind this reserved IP to. The target must be in the same VPC.
//
// The following targets are supported:
// - An endpoint gateway not already bound to a reserved IP in the subnet's zone.
// - A virtual network interface.
//
// If unspecified, the reserved IP will be created unbound.
// Models which "extend" this model:
// - ReservedIPTargetPrototypeEndpointGatewayIdentity
// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity
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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ResourceFilter : Identifies one or more resources according to the specified filter property.
type ResourceFilter struct {
// The resource type.
ResourceType *string `json:"resource_type,omitempty"`
}
// UnmarshalResourceFilter unmarshals an instance of ResourceFilter from the specified map of raw messages.
func UnmarshalResourceFilter(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ResourceFilter)
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the ResourceFilter
func (resourceFilter *ResourceFilter) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(resourceFilter.ResourceType) {
_patch["resource_type"] = resourceFilter.ResourceType
}
return
}
// ResourceGroupIdentity : The resource group to use. If unspecified, the account's [default resource
// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be 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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
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 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 {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// RestartBareMetalServerOptions : The RestartBareMetalServer options.
type RestartBareMetalServerOptions struct {
// The bare metal server identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewRestartBareMetalServerOptions : Instantiate RestartBareMetalServerOptions
func (*VpcV1) NewRestartBareMetalServerOptions(id string) *RestartBareMetalServerOptions {
return &RestartBareMetalServerOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *RestartBareMetalServerOptions) SetID(id string) *RestartBareMetalServerOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *RestartBareMetalServerOptions) SetHeaders(param map[string]string) *RestartBareMetalServerOptions {
options.Headers = param
return options
}
// RevokeAccountForPrivatePathServiceGatewayOptions : The RevokeAccountForPrivatePathServiceGateway options.
type RevokeAccountForPrivatePathServiceGatewayOptions struct {
// The private path service gateway identifier.
PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="`
// The account that will be revoked access to the private path service gateway.
Account AccountIdentityIntf `json:"account" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewRevokeAccountForPrivatePathServiceGatewayOptions : Instantiate RevokeAccountForPrivatePathServiceGatewayOptions
func (*VpcV1) NewRevokeAccountForPrivatePathServiceGatewayOptions(privatePathServiceGatewayID string, account AccountIdentityIntf) *RevokeAccountForPrivatePathServiceGatewayOptions {
return &RevokeAccountForPrivatePathServiceGatewayOptions{
PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID),
Account: account,
}
}
// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID
func (_options *RevokeAccountForPrivatePathServiceGatewayOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *RevokeAccountForPrivatePathServiceGatewayOptions {
_options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID)
return _options
}
// SetAccount : Allow user to set Account
func (_options *RevokeAccountForPrivatePathServiceGatewayOptions) SetAccount(account AccountIdentityIntf) *RevokeAccountForPrivatePathServiceGatewayOptions {
_options.Account = account
return _options
}
// SetHeaders : Allow user to set Headers
func (options *RevokeAccountForPrivatePathServiceGatewayOptions) SetHeaders(param map[string]string) *RevokeAccountForPrivatePathServiceGatewayOptions {
options.Headers = param
return options
}
// Route : Route struct
type Route struct {
// The action to perform with a packet matching the route:
// - `delegate`: delegate to system-provided routes
// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes
// - `deliver`: deliver the packet to the specified `next_hop`
// - `drop`: drop the packet
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Action *string `json:"action" validate:"required"`
// Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to`
// routing table property.
Advertise *bool `json:"advertise" validate:"required"`
// The date and time that the route was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// If present, the resource that created the route. Routes with this property present cannot
// be directly deleted. All routes with an `origin` of `service` will have this property set,
// and future `origin` values may also have this property set.
Creator RouteCreatorIntf `json:"creator,omitempty"`
// The destination CIDR 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 name for this route. The name is unique across all routes in the routing table.
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 origin of this route:
// - `service`: route was directly created by a service
// - `user`: route was directly created by a user
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Origin *string `json:"origin" validate:"required"`
// The priority of this route. Smaller values have higher priority.
//
// If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest
// priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is
// distributed between them.
Priority *int64 `json:"priority" validate:"required"`
// The zone the route applies to.
//
// If subnets are attached to the route's routing table, egress traffic from those
// subnets in this zone will be subject to this route. If this route's routing table
// has any of `route_direct_link_ingress`, `route_internet_ingress`,
// `route_transit_gateway_ingress` or `route_vpc_zone_ingress` set to`true`, traffic
// from those ingress sources arriving in this zone will be subject to this route.
Zone *ZoneReference `json:"zone" validate:"required"`
}
// Constants associated with the Route.Action property.
// The action to perform with a packet matching the route:
// - `delegate`: delegate to system-provided routes
// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes
// - `deliver`: deliver the packet to the specified `next_hop`
// - `drop`: drop the packet
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
RouteActionDelegateConst = "delegate"
RouteActionDelegateVPCConst = "delegate_vpc"
RouteActionDeliverConst = "deliver"
RouteActionDropConst = "drop"
)
// Constants associated with the Route.LifecycleState property.
// The lifecycle state of the route.
const (
RouteLifecycleStateDeletingConst = "deleting"
RouteLifecycleStateFailedConst = "failed"
RouteLifecycleStatePendingConst = "pending"
RouteLifecycleStateStableConst = "stable"
RouteLifecycleStateSuspendedConst = "suspended"
RouteLifecycleStateUpdatingConst = "updating"
RouteLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the Route.Origin property.
// The origin of this route:
// - `service`: route was directly created by a service
// - `user`: route was directly created by a user
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
RouteOriginServiceConst = "service"
RouteOriginUserConst = "user"
)
// 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, "action", &obj.Action)
if err != nil {
err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise)
if err != nil {
err = core.SDKErrorf(err, "", "advertise-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "creator", &obj.Creator, UnmarshalRouteCreator)
if err != nil {
err = core.SDKErrorf(err, "", "creator-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "destination", &obj.Destination)
if err != nil {
err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHop)
if err != nil {
err = core.SDKErrorf(err, "", "next_hop-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "origin", &obj.Origin)
if err != nil {
err = core.SDKErrorf(err, "", "origin-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "priority", &obj.Priority)
if err != nil {
err = core.SDKErrorf(err, "", "priority-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
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 *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of routes in the VPC routing table.
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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRoute)
if err != nil {
err = core.SDKErrorf(err, "", "routes-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *RouteCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// RouteCollectionVPCContext : RouteCollectionVPCContext struct
type RouteCollectionVPCContext struct {
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of routes in the VPC default routing table.
Routes []Route `json:"routes" validate:"required"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalRouteCollectionVPCContext unmarshals an instance of RouteCollectionVPCContext from the specified map of raw messages.
func UnmarshalRouteCollectionVPCContext(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(RouteCollectionVPCContext)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRoute)
if err != nil {
err = core.SDKErrorf(err, "", "routes-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *RouteCollectionVPCContext) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// RouteCreator : If present, the resource that created the route. Routes with this property present cannot be directly deleted. All
// routes with an `origin` of `service` will have this property set, and future `origin` values may also have this
// property set.
// Models which "extend" this model:
// - RouteCreatorVPNGatewayReference
// - RouteCreatorVPNServerReference
type RouteCreator struct {
// The CRN for this VPN gateway.
CRN *string `json:"crn,omitempty"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this VPN gateway.
Href *string `json:"href,omitempty"`
// The unique identifier for this VPN gateway.
ID *string `json:"id,omitempty"`
// The name for this VPN gateway. The name is unique across all VPN gateways in the VPC.
Name *string `json:"name,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type,omitempty"`
}
// Constants associated with the RouteCreator.ResourceType property.
// The resource type.
const (
RouteCreatorResourceTypeVPNGatewayConst = "vpn_gateway"
)
func (*RouteCreator) isaRouteCreator() bool {
return true
}
type RouteCreatorIntf interface {
isaRouteCreator() bool
}
// UnmarshalRouteCreator unmarshals an instance of RouteCreator from the specified map of raw messages.
func UnmarshalRouteCreator(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(RouteCreator)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
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 [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in
// the future.
Address *string `json:"address,omitempty"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this VPN gateway connection.
Href *string `json:"href,omitempty"`
// The unique identifier for this VPN gateway connection.
ID *string `json:"id,omitempty"`
// The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway.
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 {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// RouteNextHopPatch : If `action` is `deliver`, the next hop that packets will be delivered to (must not be
// `0.0.0.0`). For other `action` values, specify `0.0.0.0` or remove it by specifying
// `null`.
//
// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has
// an `action` of `deliver` and `next_hop` is an IP address.
// Models which "extend" this model:
// - RouteNextHopPatchRouteNextHopIP
// - RouteNextHopPatchVPNGatewayConnectionIdentity
type RouteNextHopPatch struct {
// The sentinel IP address (`0.0.0.0`).
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in
// the future.
Address *string `json:"address,omitempty"`
// The unique identifier for this VPN gateway connection.
ID *string `json:"id,omitempty"`
// The URL for this VPN gateway connection.
Href *string `json:"href,omitempty"`
}
func (*RouteNextHopPatch) isaRouteNextHopPatch() bool {
return true
}
type RouteNextHopPatchIntf interface {
isaRouteNextHopPatch() bool
asPatch() map[string]interface{}
}
// UnmarshalRouteNextHopPatch unmarshals an instance of RouteNextHopPatch from the specified map of raw messages.
func UnmarshalRouteNextHopPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(RouteNextHopPatch)
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the RouteNextHopPatch
func (routeNextHopPatch *RouteNextHopPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(routeNextHopPatch.Address) {
_patch["address"] = routeNextHopPatch.Address
}
if !core.IsNil(routeNextHopPatch.ID) {
_patch["id"] = routeNextHopPatch.ID
}
if !core.IsNil(routeNextHopPatch.Href) {
_patch["href"] = routeNextHopPatch.Href
}
return
}
// RouteNextHopPrototype : If `action` is `deliver`, the next hop that packets will be delivered to (must not be
// `0.0.0.0`). For other `action` values, it must be omitted or specified as `0.0.0.0`.
//
// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has
// an `action` of `deliver` and `next_hop` is an IP address.
// Models which "extend" this model:
// - RouteNextHopPrototypeRouteNextHopIP
// - RouteNextHopPrototypeVPNGatewayConnectionIdentity
type RouteNextHopPrototype struct {
// The sentinel IP address (`0.0.0.0`).
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in
// the future.
Address *string `json:"address,omitempty"`
// The unique identifier for this VPN gateway connection.
ID *string `json:"id,omitempty"`
// The URL for this VPN gateway connection.
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 {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// RoutePatch : RoutePatch struct
type RoutePatch struct {
// Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to`
// routing table property.
//
// Since all routes in a routing table with the same `destination` and `zone` must have the same `advertise` value,
// this property can only be changed for routes with a unique
// `destination` and `zone` in the routing table. For more information, see [Advertising
// routes](https://cloud.ibm.com/docs/vpc?topic=vpc-about-custom-routes#rt-advertising-routes).
Advertise *bool `json:"advertise,omitempty"`
// The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-`
// are reserved for system-provided routes, and are not allowed.
Name *string `json:"name,omitempty"`
// If `action` is `deliver`, the next hop that packets will be delivered to (must not be
// `0.0.0.0`). For other `action` values, specify `0.0.0.0` or remove it by specifying
// `null`.
//
// At most two routes per `zone` in a table can have the same `destination` and `priority`,
// and only when each route has an `action` of `deliver` and `next_hop` is an IP address.
NextHop RouteNextHopPatchIntf `json:"next_hop,omitempty"`
// The priority of this route. Smaller values have higher priority.
//
// If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest
// priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is
// distributed between them.
Priority *int64 `json:"priority,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, "advertise", &obj.Advertise)
if err != nil {
err = core.SDKErrorf(err, "", "advertise-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHopPatch)
if err != nil {
err = core.SDKErrorf(err, "", "next_hop-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "priority", &obj.Priority)
if err != nil {
err = core.SDKErrorf(err, "", "priority-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(routePatch.Advertise) {
_patch["advertise"] = routePatch.Advertise
}
if !core.IsNil(routePatch.Name) {
_patch["name"] = routePatch.Name
}
if !core.IsNil(routePatch.NextHop) {
_patch["next_hop"] = routePatch.NextHop.asPatch()
}
if !core.IsNil(routePatch.Priority) {
_patch["priority"] = routePatch.Priority
}
return
}
// RoutePrototype : RoutePrototype struct
type RoutePrototype struct {
// The action to perform with a packet matching the route:
// - `delegate`: delegate to system-provided routes
// - `delegate_vpc`: delegate to system-provided routes, ignoring Internet-bound routes
// - `deliver`: deliver the packet to the specified `next_hop`
// - `drop`: drop the packet.
Action *string `json:"action,omitempty"`
// Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to`
// routing table property.
//
// All routes in a routing table with the same `destination` and `zone` must have the same
// `advertise` value.
Advertise *bool `json:"advertise,omitempty"`
// The destination CIDR of the route. The host identifier in the CIDR must be zero.
//
// At most two routes per `zone` in a table can have the same `destination` and
// `priority`, 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 name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-`
// are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of
// randomly-selected words.
Name *string `json:"name,omitempty"`
// If `action` is `deliver`, the next hop that packets will be delivered to (must not be
// `0.0.0.0`). For other `action` values, it must be omitted or specified as `0.0.0.0`.
//
// At most two routes per `zone` in a table can have the same `destination` and `priority`,
// and only when each route has an `action` of `deliver` and `next_hop` is an IP address.
NextHop RouteNextHopPrototypeIntf `json:"next_hop,omitempty"`
// The priority of this route. Smaller values have higher priority.
//
// If a routing table contains multiple routes with the same `zone` and `destination`, the route with the highest
// priority (smallest value) is selected. If two routes have the same `destination` and `priority`, traffic is
// distributed between them.
Priority *int64 `json:"priority,omitempty"`
// The zone to apply the route to.
//
// If subnets are attached to the route's routing table, egress traffic from those
// subnets in this zone will be subject to this route. If this route's routing table
// has any of `route_direct_link_ingress`, `route_internet_ingress`,
// `route_transit_gateway_ingress` or `route_vpc_zone_ingress` set to`true`, traffic
// from those ingress sources arriving 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 system-provided routes
// - `delegate_vpc`: delegate to system-provided 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")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
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 {
err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise)
if err != nil {
err = core.SDKErrorf(err, "", "advertise-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "destination", &obj.Destination)
if err != nil {
err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHopPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "next_hop-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "priority", &obj.Priority)
if err != nil {
err = core.SDKErrorf(err, "", "priority-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
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 *Deleted `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 name for this route. The name is unique across all routes in the routing table.
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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// RoutingTable : RoutingTable struct
type RoutingTable struct {
// The filters specifying the resources that may create routes in this routing table.
//
// The resources and types of filters supported by this property is expected to
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"`
// The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these
// sources.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"`
// The date and time that this routing table was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The CRN for this VPC routing table.
CRN *string `json:"crn" 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 for this routing table. The name is unique across all routing tables for the VPC.
Name *string `json:"name" validate:"required"`
// The resource group for this routing table.
ResourceGroup *ResourceGroupReference `json:"resource_group" 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 in a subnet in the route's `zone` that is
// able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of 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 the internet.
//
// Incoming traffic will be routed according to the routing table with two exceptions:
// - Traffic destined for IP addresses associated with public gateways will not be
// subject to routes in this routing table.
// - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is
// an IP address in a subnet in the route's `zone` that is able to accept traffic.
// Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway
// connection, the packet will be dropped.
RouteInternetIngress *bool `json:"route_internet_ingress" validate:"required"`
// Indicates whether this routing table is used to route traffic that originates from from [Transit
// Gateway](https://cloud.ibm.com/docs/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 in a subnet in the route's `zone` that is
// able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of 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 in a subnet in the route's `zone` that is
// able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of 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.AdvertiseRoutesTo property.
// An ingress source that routes can be advertised to:
//
// - `direct_link` (requires `route_direct_link_ingress` be set to `true`)
// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`).
const (
RoutingTableAdvertiseRoutesToDirectLinkConst = "direct_link"
RoutingTableAdvertiseRoutesToTransitGatewayConst = "transit_gateway"
)
// Constants associated with the RoutingTable.LifecycleState property.
// The lifecycle state of the routing table.
const (
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.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter)
if err != nil {
err = core.SDKErrorf(err, "", "accept_routes_from-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo)
if err != nil {
err = core.SDKErrorf(err, "", "advertise_routes_to-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault)
if err != nil {
err = core.SDKErrorf(err, "", "is_default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress)
if err != nil {
err = core.SDKErrorf(err, "", "route_direct_link_ingress-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress)
if err != nil {
err = core.SDKErrorf(err, "", "route_internet_ingress-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress)
if err != nil {
err = core.SDKErrorf(err, "", "route_transit_gateway_ingress-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress)
if err != nil {
err = core.SDKErrorf(err, "", "route_vpc_zone_ingress-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference)
if err != nil {
err = core.SDKErrorf(err, "", "routes-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo())
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 *PageLink `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 *PageLink `json:"next,omitempty"`
// A page 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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "routing_tables", &obj.RoutingTables, UnmarshalRoutingTable)
if err != nil {
err = core.SDKErrorf(err, "", "routing_tables-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *RoutingTableCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// RoutingTableIdentity : Identifies a routing table by a unique property.
// Models which "extend" this model:
// - RoutingTableIdentityByCRN
// - RoutingTableIdentityByID
// - RoutingTableIdentityByHref
type RoutingTableIdentity struct {
// The CRN for this VPC routing table.
CRN *string `json:"crn,omitempty"`
// 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
asPatch() map[string]interface{}
}
// 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, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the RoutingTableIdentity
func (routingTableIdentity *RoutingTableIdentity) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(routingTableIdentity.CRN) {
_patch["crn"] = routingTableIdentity.CRN
}
if !core.IsNil(routingTableIdentity.ID) {
_patch["id"] = routingTableIdentity.ID
}
if !core.IsNil(routingTableIdentity.Href) {
_patch["href"] = routingTableIdentity.Href
}
return
}
// RoutingTablePatch : RoutingTablePatch struct
type RoutingTablePatch struct {
// The filters specifying the resources that may create routes in this routing table
// (replacing any existing filters). All routes created by resources that match a given filter will be removed when an
// existing filter is removed. Therefore, if an empty array is specified, all filters will be removed, resulting in all
// routes not directly created by the user being removed.
//
// If specified, `resource_type` must be `vpn_gateway` or `vpn_server`.
AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"`
// The ingress sources to advertise routes to, replacing any existing sources to advertise to. Routes in the table with
// `advertise` enabled will be advertised to these sources.
AdvertiseRoutesTo []string `json:"advertise_routes_to,omitempty"`
// The name for this routing table. The name must not be used by another routing table in the VPC.
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, provided `direct_link` is absent from
// `advertise_routes_to`.
//
// 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 in a subnet in the route's `zone` that is
// able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of 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 the internet. Updating to `true`
// selects this routing table, provided no other routing table in the VPC already has this property set to `true`.
// Updating to `false` deselects this routing table.
//
// Incoming traffic will be routed according to the routing table with two exceptions:
// - Traffic destined for IP addresses associated with public gateways will not be subject
// to routes in this routing table.
// - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is an
// IP address in a subnet in the route's `zone` that is able to accept traffic.
// Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway
// connection, the packet will be dropped.
RouteInternetIngress *bool `json:"route_internet_ingress,omitempty"`
// Indicates whether this routing table is used to route traffic that originates from
// [Transit Gateway](https://cloud.ibm.com/docs/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,
// provided `transit_gateway` is absent from `advertise_routes_to`.
//
// 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 in a subnet in the route's `zone` that is
// able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of 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 in a subnet in the route's `zone` that is
// able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway
// connection, the packet will be dropped.
RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"`
}
// Constants associated with the RoutingTablePatch.AdvertiseRoutesTo property.
// An ingress source that routes can be advertised to:
//
// - `direct_link` (requires `route_direct_link_ingress` be set to `true`)
// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`).
const (
RoutingTablePatchAdvertiseRoutesToDirectLinkConst = "direct_link"
RoutingTablePatchAdvertiseRoutesToTransitGatewayConst = "transit_gateway"
)
// 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.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter)
if err != nil {
err = core.SDKErrorf(err, "", "accept_routes_from-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo)
if err != nil {
err = core.SDKErrorf(err, "", "advertise_routes_to-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress)
if err != nil {
err = core.SDKErrorf(err, "", "route_direct_link_ingress-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress)
if err != nil {
err = core.SDKErrorf(err, "", "route_internet_ingress-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress)
if err != nil {
err = core.SDKErrorf(err, "", "route_transit_gateway_ingress-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress)
if err != nil {
err = core.SDKErrorf(err, "", "route_vpc_zone_ingress-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(routingTablePatch.AcceptRoutesFrom) {
var acceptRoutesFromPatches []map[string]interface{}
for _, acceptRoutesFrom := range routingTablePatch.AcceptRoutesFrom {
acceptRoutesFromPatches = append(acceptRoutesFromPatches, acceptRoutesFrom.asPatch())
}
_patch["accept_routes_from"] = acceptRoutesFromPatches
}
if !core.IsNil(routingTablePatch.AdvertiseRoutesTo) {
_patch["advertise_routes_to"] = routingTablePatch.AdvertiseRoutesTo
}
if !core.IsNil(routingTablePatch.Name) {
_patch["name"] = routingTablePatch.Name
}
if !core.IsNil(routingTablePatch.RouteDirectLinkIngress) {
_patch["route_direct_link_ingress"] = routingTablePatch.RouteDirectLinkIngress
}
if !core.IsNil(routingTablePatch.RouteInternetIngress) {
_patch["route_internet_ingress"] = routingTablePatch.RouteInternetIngress
}
if !core.IsNil(routingTablePatch.RouteTransitGatewayIngress) {
_patch["route_transit_gateway_ingress"] = routingTablePatch.RouteTransitGatewayIngress
}
if !core.IsNil(routingTablePatch.RouteVPCZoneIngress) {
_patch["route_vpc_zone_ingress"] = routingTablePatch.RouteVPCZoneIngress
}
return
}
// RoutingTableReference : RoutingTableReference struct
type RoutingTableReference struct {
// The CRN for this VPC routing table.
CRN *string `json:"crn" validate:"required"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `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 name for this routing table. The name is unique across all routing tables for the VPC.
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.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
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 CRN for this security group.
CRN *string `json:"crn" validate:"required"`
// The URL for this security group.
Href *string `json:"href" validate:"required"`
// The unique identifier for this security group.
ID *string `json:"id" validate:"required"`
// The name for this security group. The name is unique across all security groups for the VPC.
Name *string `json:"name" validate:"required"`
// The resource group for this security group.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The rules for this security group. If no rules exist, no traffic will be allowed.
Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"`
// The targets for this security group.
Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"`
// The VPC this security group resides in.
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 {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule)
if err != nil {
err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference)
if err != nil {
err = core.SDKErrorf(err, "", "targets-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
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 *PageLink `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 *PageLink `json:"next,omitempty"`
// A page 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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroup)
if err != nil {
err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *SecurityGroupCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// 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 CRN for this security group.
CRN *string `json:"crn,omitempty"`
// The URL for this security group.
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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SecurityGroupPatch : SecurityGroupPatch struct
type SecurityGroupPatch struct {
// The name for this security group. The name must not be used by another security group for the VPC.
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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(securityGroupPatch.Name) {
_patch["name"] = securityGroupPatch.Name
}
return
}
// SecurityGroupReference : SecurityGroupReference struct
type SecurityGroupReference struct {
// The CRN for this security group.
CRN *string `json:"crn" validate:"required"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this security group.
Href *string `json:"href" validate:"required"`
// The unique identifier for this security group.
ID *string `json:"id" validate:"required"`
// The name for this security group. The name is unique across all security groups for the VPC.
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 {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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 allow.
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 allow. The format of `local.address`, `remote.address`,
// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used.
//
// If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP
// version.
IPVersion *string `json:"ip_version" validate:"required"`
// The local IP address or range of local IP addresses to which this rule will allow inbound
// traffic (or from which, for outbound traffic). A CIDR block of `0.0.0.0/0` allows traffic
// to all local IP addresses (or from all local IP addresses, for outbound rules).
Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"`
// The network protocol.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Protocol *string `json:"protocol" validate:"required"`
// The remote IP addresses or security groups from which this rule allows traffic (or to
// which, for outbound rules). A CIDR block of `0.0.0.0/0` allows traffic from any source
// (or to any destination, for outbound rules).
Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"`
// The ICMP traffic code to allow. If absent, all codes are allowed.
Code *int64 `json:"code,omitempty"`
// The ICMP traffic type to allow. If absent, all types are allowed.
Type *int64 `json:"type,omitempty"`
// The inclusive upper bound of the TCP or UDP destination port range.
PortMax *int64 `json:"port_max,omitempty"`
// The inclusive lower bound of the TCP or UDP destination port range.
PortMin *int64 `json:"port_min,omitempty"`
}
// Constants associated with the SecurityGroupRule.Direction property.
// The direction of traffic to allow.
const (
SecurityGroupRuleDirectionInboundConst = "inbound"
SecurityGroupRuleDirectionOutboundConst = "outbound"
)
// Constants associated with the SecurityGroupRule.IPVersion property.
// The IP version to allow. The format of `local.address`, `remote.address`,
// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used.
//
// If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP
// version.
const (
SecurityGroupRuleIPVersionIpv4Const = "ipv4"
)
// Constants associated with the SecurityGroupRule.Protocol property.
// The network protocol.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
SecurityGroupRuleProtocolAllConst = "all"
SecurityGroupRuleProtocolIcmpConst = "icmp"
SecurityGroupRuleProtocolTCPConst = "tcp"
SecurityGroupRuleProtocolUDPConst = "udp"
)
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 {
errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error())
err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo())
return
}
if discValue == "" {
err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo())
return
}
if discValue == "all" {
err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolAll-error", common.GetComponentInfo())
}
} else if discValue == "icmp" {
err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolIcmp-error", common.GetComponentInfo())
}
} else if discValue == "tcp" {
err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolTcpudp-error", common.GetComponentInfo())
}
} else if discValue == "udp" {
err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolTcpudp-error", common.GetComponentInfo())
}
} else {
errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue)
err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo())
}
return
}
// SecurityGroupRuleCollection : SecurityGroupRuleCollection struct
type SecurityGroupRuleCollection struct {
// The rules for the security group.
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 {
err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SecurityGroupRuleLocal : The local IP address or range of local IP addresses to which this rule will allow inbound traffic (or from which, for
// outbound traffic). A CIDR block of `0.0.0.0/0` allows traffic to all local IP addresses (or from all local IP
// addresses, for outbound rules).
// Models which "extend" this model:
// - SecurityGroupRuleLocalIP
// - SecurityGroupRuleLocalCIDR
type SecurityGroupRuleLocal struct {
// The IP address.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in
// the future.
Address *string `json:"address,omitempty"`
// The CIDR block.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address
// blocks in the future.
CIDRBlock *string `json:"cidr_block,omitempty"`
}
func (*SecurityGroupRuleLocal) isaSecurityGroupRuleLocal() bool {
return true
}
type SecurityGroupRuleLocalIntf interface {
isaSecurityGroupRuleLocal() bool
}
// UnmarshalSecurityGroupRuleLocal unmarshals an instance of SecurityGroupRuleLocal from the specified map of raw messages.
func UnmarshalSecurityGroupRuleLocal(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SecurityGroupRuleLocal)
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock)
if err != nil {
err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SecurityGroupRuleLocalPatch : The local IP address or range of local IP addresses to which this rule will allow inbound traffic (or from which, for
// outbound traffic). Can be specified as an IP address or a CIDR block.
//
// Specify a CIDR block of `0.0.0.0/0` to allow traffic to all local IP addresses (or from all local IP addresses, for
// outbound rules).
// Models which "extend" this model:
// - SecurityGroupRuleLocalPatchIP
// - SecurityGroupRuleLocalPatchCIDR
type SecurityGroupRuleLocalPatch struct {
// The IP address.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in
// the future.
Address *string `json:"address,omitempty"`
// The CIDR block.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address
// blocks in the future.
CIDRBlock *string `json:"cidr_block,omitempty"`
}
func (*SecurityGroupRuleLocalPatch) isaSecurityGroupRuleLocalPatch() bool {
return true
}
type SecurityGroupRuleLocalPatchIntf interface {
isaSecurityGroupRuleLocalPatch() bool
asPatch() map[string]interface{}
}
// UnmarshalSecurityGroupRuleLocalPatch unmarshals an instance of SecurityGroupRuleLocalPatch from the specified map of raw messages.
func UnmarshalSecurityGroupRuleLocalPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SecurityGroupRuleLocalPatch)
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock)
if err != nil {
err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the SecurityGroupRuleLocalPatch
func (securityGroupRuleLocalPatch *SecurityGroupRuleLocalPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(securityGroupRuleLocalPatch.Address) {
_patch["address"] = securityGroupRuleLocalPatch.Address
}
if !core.IsNil(securityGroupRuleLocalPatch.CIDRBlock) {
_patch["cidr_block"] = securityGroupRuleLocalPatch.CIDRBlock
}
return
}
// SecurityGroupRuleLocalPrototype : The local IP address or range of local IP addresses to which this rule will allow inbound traffic (or from which, for
// outbound traffic).
//
// If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic to all local IP addresses (or from all
// local IP addresses, for outbound rules).
// Models which "extend" this model:
// - SecurityGroupRuleLocalPrototypeIP
// - SecurityGroupRuleLocalPrototypeCIDR
type SecurityGroupRuleLocalPrototype struct {
// The IP address.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in
// the future.
Address *string `json:"address,omitempty"`
// The CIDR block.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address
// blocks in the future.
CIDRBlock *string `json:"cidr_block,omitempty"`
}
func (*SecurityGroupRuleLocalPrototype) isaSecurityGroupRuleLocalPrototype() bool {
return true
}
type SecurityGroupRuleLocalPrototypeIntf interface {
isaSecurityGroupRuleLocalPrototype() bool
}
// UnmarshalSecurityGroupRuleLocalPrototype unmarshals an instance of SecurityGroupRuleLocalPrototype from the specified map of raw messages.
func UnmarshalSecurityGroupRuleLocalPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SecurityGroupRuleLocalPrototype)
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock)
if err != nil {
err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SecurityGroupRulePatch : SecurityGroupRulePatch struct
type SecurityGroupRulePatch struct {
// The ICMP traffic code to allow. If set, `type` must also be set.
//
// Specify `null` to remove an existing ICMP traffic code.
Code *int64 `json:"code,omitempty"`
// The direction of traffic to allow.
Direction *string `json:"direction,omitempty"`
// The IP version to allow. The format of `local.address`, `remote.address`,
// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used.
//
// If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP
// version.
IPVersion *string `json:"ip_version,omitempty"`
// The local IP address or range of local IP addresses to which this rule will allow inbound
// traffic (or from which, for outbound traffic). Can be specified as an IP address or a CIDR
// block.
//
// Specify a CIDR block of `0.0.0.0/0` to allow traffic to all local IP addresses (or from all
// local IP addresses, for outbound rules).
Local SecurityGroupRuleLocalPatchIntf `json:"local,omitempty"`
// The inclusive upper bound of the protocol destination port range. If set, `port_min` must also be set, and must not
// be larger.
//
// Specify `null` to remove an existing upper bound.
PortMax *int64 `json:"port_max,omitempty"`
// The inclusive lower bound of the protocol destination port range. If set, `port_max` must also be set, and must not
// be smaller.
//
// Specify `null` to remove an existing lower bound.
PortMin *int64 `json:"port_min,omitempty"`
// The remote 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 destination, for outbound rules).
Remote SecurityGroupRuleRemotePatchIntf `json:"remote,omitempty"`
// The ICMP traffic type to allow.
//
// Specify `null` to remove an existing ICMP traffic type value.
Type *int64 `json:"type,omitempty"`
}
// Constants associated with the SecurityGroupRulePatch.Direction property.
// The direction of traffic to allow.
const (
SecurityGroupRulePatchDirectionInboundConst = "inbound"
SecurityGroupRulePatchDirectionOutboundConst = "outbound"
)
// Constants associated with the SecurityGroupRulePatch.IPVersion property.
// The IP version to allow. The format of `local.address`, `remote.address`,
// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used.
//
// If `remote` references a security group, then this rule only applies to IP addresses 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 {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "direction", &obj.Direction)
if err != nil {
err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion)
if err != nil {
err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocalPatch)
if err != nil {
err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax)
if err != nil {
err = core.SDKErrorf(err, "", "port_max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin)
if err != nil {
err = core.SDKErrorf(err, "", "port_min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePatch)
if err != nil {
err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(securityGroupRulePatch.Code) {
_patch["code"] = securityGroupRulePatch.Code
}
if !core.IsNil(securityGroupRulePatch.Direction) {
_patch["direction"] = securityGroupRulePatch.Direction
}
if !core.IsNil(securityGroupRulePatch.IPVersion) {
_patch["ip_version"] = securityGroupRulePatch.IPVersion
}
if !core.IsNil(securityGroupRulePatch.Local) {
_patch["local"] = securityGroupRulePatch.Local.asPatch()
}
if !core.IsNil(securityGroupRulePatch.PortMax) {
_patch["port_max"] = securityGroupRulePatch.PortMax
}
if !core.IsNil(securityGroupRulePatch.PortMin) {
_patch["port_min"] = securityGroupRulePatch.PortMin
}
if !core.IsNil(securityGroupRulePatch.Remote) {
_patch["remote"] = securityGroupRulePatch.Remote.asPatch()
}
if !core.IsNil(securityGroupRulePatch.Type) {
_patch["type"] = securityGroupRulePatch.Type
}
return
}
// SecurityGroupRulePrototype : SecurityGroupRulePrototype struct
// Models which "extend" this model:
// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll
// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp
// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp
type SecurityGroupRulePrototype struct {
// The direction of traffic to allow.
Direction *string `json:"direction" validate:"required"`
// The IP version to allow. The format of `local.address`, `remote.address`,
// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used.
//
// If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP
// version.
IPVersion *string `json:"ip_version,omitempty"`
// The local IP address or range of local IP addresses to which this rule will allow inbound
// traffic (or from which, for outbound traffic).
//
// If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic to all local IP
// addresses (or from all local IP addresses, for outbound rules).
Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"`
// The network protocol.
Protocol *string `json:"protocol" validate:"required"`
// The remote 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 within the VPC.
//
// If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source
// (or to any destination, for outbound rules).
Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"`
// The ICMP traffic code to allow.
//
// If specified, `type` must also be specified. If unspecified, all codes are allowed.
Code *int64 `json:"code,omitempty"`
// The ICMP traffic type to allow.
//
// If unspecified, all types are allowed.
Type *int64 `json:"type,omitempty"`
// The inclusive upper bound of the TCP or UDP destination port range.
//
// If specified, `port_min` must also be specified, and must not be larger. If unspecified,
// `port_min` must also be unspecified, allowing traffic on all destination ports.
PortMax *int64 `json:"port_max,omitempty"`
// The inclusive lower bound of the TCP or UDP destination port range.
//
// If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be
// unspecified, allowing traffic on all destination ports.
PortMin *int64 `json:"port_min,omitempty"`
}
// Constants associated with the SecurityGroupRulePrototype.Direction property.
// The direction of traffic to allow.
const (
SecurityGroupRulePrototypeDirectionInboundConst = "inbound"
SecurityGroupRulePrototypeDirectionOutboundConst = "outbound"
)
// Constants associated with the SecurityGroupRulePrototype.IPVersion property.
// The IP version to allow. The format of `local.address`, `remote.address`,
// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used.
//
// If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP
// version.
const (
SecurityGroupRulePrototypeIPVersionIpv4Const = "ipv4"
)
// Constants associated with the SecurityGroupRulePrototype.Protocol property.
// The network protocol.
const (
SecurityGroupRulePrototypeProtocolAllConst = "all"
SecurityGroupRulePrototypeProtocolIcmpConst = "icmp"
SecurityGroupRulePrototypeProtocolTCPConst = "tcp"
SecurityGroupRulePrototypeProtocolUDPConst = "udp"
)
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) {
obj := new(SecurityGroupRulePrototype)
err = core.UnmarshalPrimitive(m, "direction", &obj.Direction)
if err != nil {
err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion)
if err != nil {
err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocalPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol)
if err != nil {
err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax)
if err != nil {
err = core.SDKErrorf(err, "", "port_max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin)
if err != nil {
err = core.SDKErrorf(err, "", "port_min-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SecurityGroupRuleRemote : The remote IP addresses or security groups from which this rule allows traffic (or to which, for outbound rules). A
// CIDR block of `0.0.0.0/0` allows traffic from any source
// (or to any destination, for outbound rules).
// Models which "extend" this model:
// - SecurityGroupRuleRemoteIP
// - SecurityGroupRuleRemoteCIDR
// - SecurityGroupRuleRemoteSecurityGroupReference
type SecurityGroupRuleRemote struct {
// The IP address.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in
// the future.
Address *string `json:"address,omitempty"`
// The CIDR block.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address
// blocks in the future.
CIDRBlock *string `json:"cidr_block,omitempty"`
// The CRN for this security group.
CRN *string `json:"crn,omitempty"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this security group.
Href *string `json:"href,omitempty"`
// The unique identifier for this security group.
ID *string `json:"id,omitempty"`
// The name for this security group. The name is unique across all security groups for the VPC.
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 {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock)
if err != nil {
err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SecurityGroupRuleRemotePatch : The remote 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 destination, for outbound rules).
// Models which "extend" this model:
// - SecurityGroupRuleRemotePatchIP
// - SecurityGroupRuleRemotePatchCIDR
// - SecurityGroupRuleRemotePatchSecurityGroupIdentity
type SecurityGroupRuleRemotePatch struct {
// The IP address.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in
// the future.
Address *string `json:"address,omitempty"`
// The CIDR block.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address
// blocks in the future.
CIDRBlock *string `json:"cidr_block,omitempty"`
// The unique identifier for this security group.
ID *string `json:"id,omitempty"`
// The CRN for this security group.
CRN *string `json:"crn,omitempty"`
// The URL for this security group.
Href *string `json:"href,omitempty"`
}
func (*SecurityGroupRuleRemotePatch) isaSecurityGroupRuleRemotePatch() bool {
return true
}
type SecurityGroupRuleRemotePatchIntf interface {
isaSecurityGroupRuleRemotePatch() bool
asPatch() map[string]interface{}
}
// 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 {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock)
if err != nil {
err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the SecurityGroupRuleRemotePatch
func (securityGroupRuleRemotePatch *SecurityGroupRuleRemotePatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(securityGroupRuleRemotePatch.Address) {
_patch["address"] = securityGroupRuleRemotePatch.Address
}
if !core.IsNil(securityGroupRuleRemotePatch.CIDRBlock) {
_patch["cidr_block"] = securityGroupRuleRemotePatch.CIDRBlock
}
if !core.IsNil(securityGroupRuleRemotePatch.ID) {
_patch["id"] = securityGroupRuleRemotePatch.ID
}
if !core.IsNil(securityGroupRuleRemotePatch.CRN) {
_patch["crn"] = securityGroupRuleRemotePatch.CRN
}
if !core.IsNil(securityGroupRuleRemotePatch.Href) {
_patch["href"] = securityGroupRuleRemotePatch.Href
}
return
}
// SecurityGroupRuleRemotePrototype : The remote 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 within the VPC.
//
// If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source
// (or to any destination, for outbound rules).
// Models which "extend" this model:
// - SecurityGroupRuleRemotePrototypeIP
// - SecurityGroupRuleRemotePrototypeCIDR
// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentity
type SecurityGroupRuleRemotePrototype struct {
// The IP address.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in
// the future.
Address *string `json:"address,omitempty"`
// The CIDR block.
//
// This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address
// blocks in the future.
CIDRBlock *string `json:"cidr_block,omitempty"`
// The unique identifier for this security group.
ID *string `json:"id,omitempty"`
// The CRN for this security group.
CRN *string `json:"crn,omitempty"`
// The URL for this security group.
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 {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock)
if err != nil {
err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
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 *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of targets for the security group.
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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference)
if err != nil {
err = core.SDKErrorf(err, "", "targets-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *SecurityGroupTargetCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// SecurityGroupTargetReference : A target of this security group.
//
// The resources supported by this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
// Models which "extend" this model:
// - SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext
// - SecurityGroupTargetReferenceEndpointGatewayReference
// - SecurityGroupTargetReferenceLoadBalancerReference
// - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext
// - SecurityGroupTargetReferenceVirtualNetworkInterfaceReference
// - SecurityGroupTargetReferenceVPNServerReference
type SecurityGroupTargetReference struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment.
Href *string `json:"href,omitempty"`
// The unique identifier for this bare metal server network interface.
//
// If this bare metal server has network attachments, this network interface is a
// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients) of its
// corresponding network attachment and its attached virtual network interface, and the identifier is that of the
// corresponding network attachment.
ID *string `json:"id,omitempty"`
// The name for this bare metal server network interface.
Name *string `json:"name,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type,omitempty"`
// The CRN for this endpoint gateway.
CRN *string `json:"crn,omitempty"`
// The primary IP for this virtual network interface.
PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"`
// The associated subnet.
Subnet *SubnetReference `json:"subnet,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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SetSubnetPublicGatewayOptions : The SetSubnetPublicGateway options.
type SetSubnetPublicGatewayOptions struct {
// The subnet identifier.
ID *string `json:"id" validate:"required,ne="`
// The public gateway identity.
PublicGatewayIdentity PublicGatewayIdentityIntf `json:"PublicGatewayIdentity" 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
}
// Share : Share struct
type Share struct {
// The access control mode for the share:
//
// - `security_group`: The security groups on the virtual network interface for a mount
// target control access to the mount target.
// - `vpc`: All clients in the VPC for a mount target have access to the mount target.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
AccessControlMode *string `json:"access_control_mode" validate:"required"`
// The accessor binding role of this file share:
// - `none`: This file share is not participating in access with another file share
// - `origin`: This file share is the origin for one or more file shares
// (which may be in other accounts)
// - `accessor`: This file share is providing access to another file share
// (which may be in another account).
AccessorBindingRole *string `json:"accessor_binding_role" validate:"required"`
// The accessor bindings for this file share. Each accessor binding identifies a resource (possibly in another account)
// with access to this file share's data and its snapshots.
AccessorBindings []ShareAccessorBindingReference `json:"accessor_bindings" validate:"required"`
// The transit encryption modes allowed for this share:
// - `none`: Not encrypted in transit.
// - `user_managed`: Encrypted in transit using an instance identity certificate.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes" validate:"required"`
// The date and time that the file share is created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The CRN for this file share.
CRN *string `json:"crn" validate:"required"`
// The type of encryption used for this file share.
Encryption *string `json:"encryption" validate:"required"`
// The key used to encrypt this file share.
//
// This property will be present if `encryption` is `user_managed`.
EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"`
// The URL for this file share.
Href *string `json:"href" validate:"required"`
// The unique identifier for this file share.
ID *string `json:"id" validate:"required"`
// The owner assigned to the file share at creation.
InitialOwner *ShareInitialOwner `json:"initial_owner" validate:"required"`
// The maximum input/output operations per second (IOPS) for the file share. In addition, each client accessing the
// share will be restricted to 48,000 IOPS.
//
// The maximum IOPS for a share may increase in the future.
Iops *int64 `json:"iops" validate:"required"`
// The latest job associated with this file share.
//
// This property will be absent if no jobs have been created for this file share.
LatestJob *ShareJob `json:"latest_job,omitempty"`
// Information about the latest synchronization for this file share.
//
// This property will be present when the `replication_role` is `replica` and at least
// one replication sync has been completed.
LatestSync *ShareLatestSync `json:"latest_sync,omitempty"`
// The reasons for the current `lifecycle_state` (if any).
LifecycleReasons []ShareLifecycleReason `json:"lifecycle_reasons" validate:"required"`
// The lifecycle state of the file share.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The mount targets for the file share.
MountTargets []ShareMountTargetReference `json:"mount_targets" validate:"required"`
// The name for this share. The name is unique across all shares in the region.
Name *string `json:"name" validate:"required"`
// The origin share this accessor share is referring to.
//
// This property will be present when the `accessor_binding_role` is `accessor`.
OriginShare *ShareReference `json:"origin_share,omitempty"`
// The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) for
// this file share.
Profile *ShareProfileReference `json:"profile" validate:"required"`
// The replica file share for this source file share.
//
// This property will be present when the `replication_role` is `source`.
ReplicaShare *ShareReference `json:"replica_share,omitempty"`
// The cron specification for the file share replication schedule.
//
// This property will be present when the `replication_role` is `replica`.
ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"`
// The replication role of the file share:
// - `none`: This share is not participating in replication.
// - `replica`: This share is a replication target.
// - `source`: This share is a replication source.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
ReplicationRole *string `json:"replication_role" validate:"required"`
// The replication status of the file share:
// - `active`: This share is actively participating in replication, and the replica's data is up-to-date with the
// replication schedule.
// - `degraded`: This is share is participating in replication, but the replica's data has fallen behind the
// replication schedule.
// - `failover_pending`: This share is performing a replication failover.
// - `initializing`: This share is initializing replication.
// - `none`: This share is not participating in replication.
// - `split_pending`: This share is performing a replication split.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
ReplicationStatus *string `json:"replication_status" validate:"required"`
// The reasons for the current replication status (if any).
ReplicationStatusReasons []ShareReplicationStatusReason `json:"replication_status_reasons" validate:"required"`
// The resource group for this file share.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The size of the file share (in gigabytes), excluding share snapshots.
Size *int64 `json:"size" validate:"required"`
// The total number of snapshots for this share.
SnapshotCount *int64 `json:"snapshot_count" validate:"required"`
// The total size (in gigabytes) of snapshots used for this file share.
SnapshotSize *int64 `json:"snapshot_size" validate:"required"`
// The source file share for this replica file share.
//
// This property will be present when the `replication_role` is `replica`.
SourceShare *ShareReference `json:"source_share,omitempty"`
// The snapshot this file share was cloned from.
//
// This property will be present when the share was created from a snapshot.
//
// The resources supported by this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the
// future.
SourceSnapshot ShareSourceSnapshotIntf `json:"source_snapshot,omitempty"`
// The tags for this resource.
UserTags []string `json:"user_tags" validate:"required"`
// The zone this file share resides in.
Zone *ZoneReference `json:"zone" validate:"required"`
}
// Constants associated with the Share.AccessControlMode property.
// The access control mode for the share:
//
// - `security_group`: The security groups on the virtual network interface for a mount
// target control access to the mount target.
// - `vpc`: All clients in the VPC for a mount target have access to the mount target.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ShareAccessControlModeSecurityGroupConst = "security_group"
ShareAccessControlModeVPCConst = "vpc"
)
// Constants associated with the Share.AccessorBindingRole property.
// The accessor binding role of this file share:
// - `none`: This file share is not participating in access with another file share
// - `origin`: This file share is the origin for one or more file shares
// (which may be in other accounts)
// - `accessor`: This file share is providing access to another file share
// (which may be in another account).
const (
ShareAccessorBindingRoleAccessorConst = "accessor"
ShareAccessorBindingRoleNoneConst = "none"
ShareAccessorBindingRoleOriginConst = "origin"
)
// Constants associated with the Share.AllowedTransitEncryptionModes property.
const (
ShareAllowedTransitEncryptionModesNoneConst = "none"
ShareAllowedTransitEncryptionModesUserManagedConst = "user_managed"
)
// Constants associated with the Share.Encryption property.
// The type of encryption used for this file share.
const (
ShareEncryptionProviderManagedConst = "provider_managed"
ShareEncryptionUserManagedConst = "user_managed"
)
// Constants associated with the Share.LifecycleState property.
// The lifecycle state of the file share.
const (
ShareLifecycleStateDeletingConst = "deleting"
ShareLifecycleStateFailedConst = "failed"
ShareLifecycleStatePendingConst = "pending"
ShareLifecycleStateStableConst = "stable"
ShareLifecycleStateSuspendedConst = "suspended"
ShareLifecycleStateUpdatingConst = "updating"
ShareLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the Share.ReplicationRole property.
// The replication role of the file share:
// - `none`: This share is not participating in replication.
// - `replica`: This share is a replication target.
// - `source`: This share is a replication source.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ShareReplicationRoleNoneConst = "none"
ShareReplicationRoleReplicaConst = "replica"
ShareReplicationRoleSourceConst = "source"
)
// Constants associated with the Share.ReplicationStatus property.
// The replication status of the file share:
// - `active`: This share is actively participating in replication, and the replica's data is up-to-date with the
// replication schedule.
// - `degraded`: This is share is participating in replication, but the replica's data has fallen behind the replication
// schedule.
// - `failover_pending`: This share is performing a replication failover.
// - `initializing`: This share is initializing replication.
// - `none`: This share is not participating in replication.
// - `split_pending`: This share is performing a replication split.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ShareReplicationStatusActiveConst = "active"
ShareReplicationStatusDegradedConst = "degraded"
ShareReplicationStatusFailoverPendingConst = "failover_pending"
ShareReplicationStatusInitializingConst = "initializing"
ShareReplicationStatusNoneConst = "none"
ShareReplicationStatusSplitPendingConst = "split_pending"
)
// Constants associated with the Share.ResourceType property.
// The resource type.
const (
ShareResourceTypeShareConst = "share"
)
// UnmarshalShare unmarshals an instance of Share from the specified map of raw messages.
func UnmarshalShare(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(Share)
err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode)
if err != nil {
err = core.SDKErrorf(err, "", "access_control_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "accessor_binding_role", &obj.AccessorBindingRole)
if err != nil {
err = core.SDKErrorf(err, "", "accessor_binding_role-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "accessor_bindings", &obj.AccessorBindings, UnmarshalShareAccessorBindingReference)
if err != nil {
err = core.SDKErrorf(err, "", "accessor_bindings-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "allowed_transit_encryption_modes", &obj.AllowedTransitEncryptionModes)
if err != nil {
err = core.SDKErrorf(err, "", "allowed_transit_encryption_modes-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption)
if err != nil {
err = core.SDKErrorf(err, "", "encryption-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference)
if err != nil {
err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "initial_owner", &obj.InitialOwner, UnmarshalShareInitialOwner)
if err != nil {
err = core.SDKErrorf(err, "", "initial_owner-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "iops", &obj.Iops)
if err != nil {
err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "latest_job", &obj.LatestJob, UnmarshalShareJob)
if err != nil {
err = core.SDKErrorf(err, "", "latest_job-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "latest_sync", &obj.LatestSync, UnmarshalShareLatestSync)
if err != nil {
err = core.SDKErrorf(err, "", "latest_sync-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalShareLifecycleReason)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetReference)
if err != nil {
err = core.SDKErrorf(err, "", "mount_targets-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "origin_share", &obj.OriginShare, UnmarshalShareReference)
if err != nil {
err = core.SDKErrorf(err, "", "origin_share-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileReference)
if err != nil {
err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalShareReference)
if err != nil {
err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec)
if err != nil {
err = core.SDKErrorf(err, "", "replication_cron_spec-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "replication_role", &obj.ReplicationRole)
if err != nil {
err = core.SDKErrorf(err, "", "replication_role-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "replication_status", &obj.ReplicationStatus)
if err != nil {
err = core.SDKErrorf(err, "", "replication_status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "replication_status_reasons", &obj.ReplicationStatusReasons, UnmarshalShareReplicationStatusReason)
if err != nil {
err = core.SDKErrorf(err, "", "replication_status_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "size", &obj.Size)
if err != nil {
err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "snapshot_count", &obj.SnapshotCount)
if err != nil {
err = core.SDKErrorf(err, "", "snapshot_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "snapshot_size", &obj.SnapshotSize)
if err != nil {
err = core.SDKErrorf(err, "", "snapshot_size-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareReference)
if err != nil {
err = core.SDKErrorf(err, "", "source_share-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalShareSourceSnapshot)
if err != nil {
err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags)
if err != nil {
err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareAccessorBinding : ShareAccessorBinding struct
type ShareAccessorBinding struct {
// The accessor for this share accessor binding.
Accessor ShareAccessorBindingAccessorIntf `json:"accessor" validate:"required"`
// The date and time that the share accessor binding was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The URL for this share accessor binding.
Href *string `json:"href" validate:"required"`
// The unique identifier for this share accessor binding.
ID *string `json:"id" validate:"required"`
// The lifecycle state of the file share accessor binding.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the ShareAccessorBinding.LifecycleState property.
// The lifecycle state of the file share accessor binding.
const (
ShareAccessorBindingLifecycleStateDeletingConst = "deleting"
ShareAccessorBindingLifecycleStateFailedConst = "failed"
ShareAccessorBindingLifecycleStatePendingConst = "pending"
ShareAccessorBindingLifecycleStateStableConst = "stable"
ShareAccessorBindingLifecycleStateSuspendedConst = "suspended"
ShareAccessorBindingLifecycleStateUpdatingConst = "updating"
ShareAccessorBindingLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the ShareAccessorBinding.ResourceType property.
// The resource type.
const (
ShareAccessorBindingResourceTypeShareAccessorBindingConst = "share_accessor_binding"
)
// UnmarshalShareAccessorBinding unmarshals an instance of ShareAccessorBinding from the specified map of raw messages.
func UnmarshalShareAccessorBinding(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareAccessorBinding)
err = core.UnmarshalModel(m, "accessor", &obj.Accessor, UnmarshalShareAccessorBindingAccessor)
if err != nil {
err = core.SDKErrorf(err, "", "accessor-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareAccessorBindingAccessor : The accessor for this share accessor binding.
// Models which "extend" this model:
// - ShareAccessorBindingAccessorShareReference
// - ShareAccessorBindingAccessorWatsonxMachineLearningReference
type ShareAccessorBindingAccessor struct {
// The CRN for this file share.
CRN *string `json:"crn,omitempty"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this file share.
Href *string `json:"href,omitempty"`
// The unique identifier for this file share.
ID *string `json:"id,omitempty"`
// The name for this share. The name is unique across all shares in the region.
Name *string `json:"name,omitempty"`
// If present, this property indicates that the resource associated with this reference
// is remote and therefore may not be directly retrievable.
Remote *ShareRemote `json:"remote,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type,omitempty"`
}
// Constants associated with the ShareAccessorBindingAccessor.ResourceType property.
// The resource type.
const (
ShareAccessorBindingAccessorResourceTypeShareConst = "share"
)
func (*ShareAccessorBindingAccessor) isaShareAccessorBindingAccessor() bool {
return true
}
type ShareAccessorBindingAccessorIntf interface {
isaShareAccessorBindingAccessor() bool
}
// UnmarshalShareAccessorBindingAccessor unmarshals an instance of ShareAccessorBindingAccessor from the specified map of raw messages.
func UnmarshalShareAccessorBindingAccessor(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareAccessorBindingAccessor)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalShareRemote)
if err != nil {
err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareAccessorBindingCollection : ShareAccessorBindingCollection struct
type ShareAccessorBindingCollection struct {
// A page of accessor bindings for the share.
AccessorBindings []ShareAccessorBinding `json:"accessor_bindings" validate:"required"`
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalShareAccessorBindingCollection unmarshals an instance of ShareAccessorBindingCollection from the specified map of raw messages.
func UnmarshalShareAccessorBindingCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareAccessorBindingCollection)
err = core.UnmarshalModel(m, "accessor_bindings", &obj.AccessorBindings, UnmarshalShareAccessorBinding)
if err != nil {
err = core.SDKErrorf(err, "", "accessor_bindings-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ShareAccessorBindingCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ShareAccessorBindingReference : ShareAccessorBindingReference struct
type ShareAccessorBindingReference struct {
// The URL for this share accessor binding.
Href *string `json:"href" validate:"required"`
// The unique identifier for this share accessor binding.
ID *string `json:"id" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the ShareAccessorBindingReference.ResourceType property.
// The resource type.
const (
ShareAccessorBindingReferenceResourceTypeShareAccessorBindingConst = "share_accessor_binding"
)
// UnmarshalShareAccessorBindingReference unmarshals an instance of ShareAccessorBindingReference from the specified map of raw messages.
func UnmarshalShareAccessorBindingReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareAccessorBindingReference)
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareCollection : ShareCollection struct
type ShareCollection struct {
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of file shares.
Shares []Share `json:"shares" validate:"required"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalShareCollection unmarshals an instance of ShareCollection from the specified map of raw messages.
func UnmarshalShareCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "shares", &obj.Shares, UnmarshalShare)
if err != nil {
err = core.SDKErrorf(err, "", "shares-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ShareCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ShareIdentity : Identifies a file share by a unique property.
// Models which "extend" this model:
// - ShareIdentityByID
// - ShareIdentityByCRN
// - ShareIdentityByHref
type ShareIdentity struct {
// The unique identifier for this file share.
ID *string `json:"id,omitempty"`
// The CRN for this file share.
CRN *string `json:"crn,omitempty"`
// The URL for this file share.
Href *string `json:"href,omitempty"`
}
func (*ShareIdentity) isaShareIdentity() bool {
return true
}
type ShareIdentityIntf interface {
isaShareIdentity() bool
}
// UnmarshalShareIdentity unmarshals an instance of ShareIdentity from the specified map of raw messages.
func UnmarshalShareIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareIdentity)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareInitialOwner : ShareInitialOwner struct
type ShareInitialOwner struct {
// The initial group identifier for the file share.
Gid *int64 `json:"gid,omitempty"`
// The initial user identifier for the file share.
Uid *int64 `json:"uid,omitempty"`
}
// UnmarshalShareInitialOwner unmarshals an instance of ShareInitialOwner from the specified map of raw messages.
func UnmarshalShareInitialOwner(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareInitialOwner)
err = core.UnmarshalPrimitive(m, "gid", &obj.Gid)
if err != nil {
err = core.SDKErrorf(err, "", "gid-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "uid", &obj.Uid)
if err != nil {
err = core.SDKErrorf(err, "", "uid-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareJob : ShareJob struct
type ShareJob struct {
// The status of the file share job:
// - `cancelled`: This job has been cancelled.
// - `failed`: This job has failed.
// - `queued`: This job is queued.
// - `running`: This job is running.
// - `succeeded`: This job completed successfully.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
// The reasons for the file share job status (if any).
StatusReasons []ShareJobStatusReason `json:"status_reasons" validate:"required"`
// The type of the file share job:
// - `replication_failover`: This is a share replication failover job.
// - `replication_init`: This is a share replication is initialization job.
// - `replication_split`: This is a share replication split job.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Type *string `json:"type" validate:"required"`
}
// Constants associated with the ShareJob.Status property.
// The status of the file share job:
// - `cancelled`: This job has been cancelled.
// - `failed`: This job has failed.
// - `queued`: This job is queued.
// - `running`: This job is running.
// - `succeeded`: This job completed successfully.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ShareJobStatusCancelledConst = "cancelled"
ShareJobStatusFailedConst = "failed"
ShareJobStatusQueuedConst = "queued"
ShareJobStatusRunningConst = "running"
ShareJobStatusSucceededConst = "succeeded"
)
// Constants associated with the ShareJob.Type property.
// The type of the file share job:
// - `replication_failover`: This is a share replication failover job.
// - `replication_init`: This is a share replication is initialization job.
// - `replication_split`: This is a share replication split job.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ShareJobTypeReplicationFailoverConst = "replication_failover"
ShareJobTypeReplicationInitConst = "replication_init"
ShareJobTypeReplicationSplitConst = "replication_split"
)
// UnmarshalShareJob unmarshals an instance of ShareJob from the specified map of raw messages.
func UnmarshalShareJob(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareJob)
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalShareJobStatusReason)
if err != nil {
err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareJobStatusReason : ShareJobStatusReason struct
type ShareJobStatusReason struct {
// A snake case string succinctly identifying the status reason.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the status reason.
Message *string `json:"message" validate:"required"`
// A link to documentation about this status reason.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the ShareJobStatusReason.Code property.
// A snake case string succinctly identifying the status reason.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ShareJobStatusReasonCodeCannotInitializeReplicationConst = "cannot_initialize_replication"
ShareJobStatusReasonCodeCannotReachReplicaShareConst = "cannot_reach_replica_share"
ShareJobStatusReasonCodeCannotReachSourceShareConst = "cannot_reach_source_share"
)
// UnmarshalShareJobStatusReason unmarshals an instance of ShareJobStatusReason from the specified map of raw messages.
func UnmarshalShareJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareJobStatusReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareLatestSync : Information about the latest synchronization for this file share.
//
// This property will be present when the `replication_role` is `replica` and at least one replication sync has been
// completed.
type ShareLatestSync struct {
// The completed date and time of last synchronization between the replica share and its source.
CompletedAt *strfmt.DateTime `json:"completed_at" validate:"required"`
// The data transferred (in bytes) in the last synchronization between the replica and its source.
DataTransferred *int64 `json:"data_transferred" validate:"required"`
// The start date and time of last synchronization between the replica share and its source.
StartedAt *strfmt.DateTime `json:"started_at" validate:"required"`
}
// UnmarshalShareLatestSync unmarshals an instance of ShareLatestSync from the specified map of raw messages.
func UnmarshalShareLatestSync(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareLatestSync)
err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt)
if err != nil {
err = core.SDKErrorf(err, "", "completed_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "data_transferred", &obj.DataTransferred)
if err != nil {
err = core.SDKErrorf(err, "", "data_transferred-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt)
if err != nil {
err = core.SDKErrorf(err, "", "started_at-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareLifecycleReason : ShareLifecycleReason struct
type ShareLifecycleReason struct {
// A reason code for this lifecycle state:
// - `cloning_failed`: The file share could not be cloned from the snapshot
// (contact IBM support)
// - `cloning_in_progress`: The file share is currently being cloned from the snapshot
// - `internal_error`: internal error (contact IBM support)
// - `origin_share_access_revoked`: The resource has been revoked by the share owner
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this lifecycle state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this lifecycle state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the ShareLifecycleReason.Code property.
// A reason code for this lifecycle state:
// - `cloning_failed`: The file share could not be cloned from the snapshot
// (contact IBM support)
// - `cloning_in_progress`: The file share is currently being cloned from the snapshot
// - `internal_error`: internal error (contact IBM support)
// - `origin_share_access_revoked`: The resource has been revoked by the share owner
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ShareLifecycleReasonCodeCloningFailedConst = "cloning_failed"
ShareLifecycleReasonCodeCloningInProgressConst = "cloning_in_progress"
ShareLifecycleReasonCodeInternalErrorConst = "internal_error"
ShareLifecycleReasonCodeOriginShareAccessRevokedConst = "origin_share_access_revoked"
ShareLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider"
)
// UnmarshalShareLifecycleReason unmarshals an instance of ShareLifecycleReason from the specified map of raw messages.
func UnmarshalShareLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareLifecycleReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareMountTarget : ShareMountTarget struct
type ShareMountTarget struct {
// The access control mode for the share:
//
// - `security_group`: The security groups on the virtual network interface for a mount
// target control access to the mount target.
// - `vpc`: All clients in the VPC for a mount target have access to the mount target.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
AccessControlMode *string `json:"access_control_mode" validate:"required"`
// The date and time that the share mount target was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The URL for this share mount target.
Href *string `json:"href" validate:"required"`
// The unique identifier for this share mount target.
ID *string `json:"id" validate:"required"`
// The lifecycle state of the mount target.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The mount path for the share. The server component of the mount path may be either an IP address or a fully
// qualified domain name.
//
// This property will be absent if the `lifecycle_state` of the mount target is
// 'pending', `failed`, or `deleting`.
//
// If the share's `access_control_mode` is:
//
// - `security_group`: The IP address used in the mount path is the `primary_ip`
// address of the virtual network interface for this share mount target.
// - `vpc`: The fully-qualified domain name used in the mount path is an address that
// resolves to the share mount target.
MountPath *string `json:"mount_path,omitempty"`
// The name for this share mount target. The name is unique across all mount targets for the file share.
Name *string `json:"name" validate:"required"`
// The primary IP address of the virtual network interface for the share mount target.
//
// Absent if `access_control_mode` is `vpc`.
PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The subnet of the virtual network interface for the share mount target.
//
// Absent if `access_control_mode` is `vpc`.
Subnet *SubnetReference `json:"subnet,omitempty"`
// The transit encryption mode for this share mount target:
// - `none`: Not encrypted in transit
// - `user_managed`: Encrypted in transit using an instance identity certificate
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
TransitEncryption *string `json:"transit_encryption" validate:"required"`
// The virtual network interface for this file share mount target.
//
// This property will be present when the `access_control_mode` is `security_group`.
VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface,omitempty"`
// If `access_control_mode` is:
//
// - `security_group`: The VPC for the virtual network interface for this share mount
// target
// - `vpc`: The VPC in which clients can mount the file share using this share
// mount target.
VPC *VPCReference `json:"vpc" validate:"required"`
}
// Constants associated with the ShareMountTarget.AccessControlMode property.
// The access control mode for the share:
//
// - `security_group`: The security groups on the virtual network interface for a mount
// target control access to the mount target.
// - `vpc`: All clients in the VPC for a mount target have access to the mount target.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ShareMountTargetAccessControlModeSecurityGroupConst = "security_group"
ShareMountTargetAccessControlModeVPCConst = "vpc"
)
// Constants associated with the ShareMountTarget.LifecycleState property.
// The lifecycle state of the mount target.
const (
ShareMountTargetLifecycleStateDeletingConst = "deleting"
ShareMountTargetLifecycleStateFailedConst = "failed"
ShareMountTargetLifecycleStatePendingConst = "pending"
ShareMountTargetLifecycleStateStableConst = "stable"
ShareMountTargetLifecycleStateSuspendedConst = "suspended"
ShareMountTargetLifecycleStateUpdatingConst = "updating"
ShareMountTargetLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the ShareMountTarget.ResourceType property.
// The resource type.
const (
ShareMountTargetResourceTypeShareMountTargetConst = "share_mount_target"
)
// Constants associated with the ShareMountTarget.TransitEncryption property.
// The transit encryption mode for this share mount target:
// - `none`: Not encrypted in transit
// - `user_managed`: Encrypted in transit using an instance identity certificate
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ShareMountTargetTransitEncryptionNoneConst = "none"
ShareMountTargetTransitEncryptionUserManagedConst = "user_managed"
)
// UnmarshalShareMountTarget unmarshals an instance of ShareMountTarget from the specified map of raw messages.
func UnmarshalShareMountTarget(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareMountTarget)
err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode)
if err != nil {
err = core.SDKErrorf(err, "", "access_control_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "mount_path", &obj.MountPath)
if err != nil {
err = core.SDKErrorf(err, "", "mount_path-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption)
if err != nil {
err = core.SDKErrorf(err, "", "transit_encryption-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext)
if err != nil {
err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareMountTargetCollection : ShareMountTargetCollection struct
type ShareMountTargetCollection struct {
// A link to the first page of resources.
First *PageLink `json:"first" validate:"required"`
// The maximum number of resources that can be returned by the request.
Limit *int64 `json:"limit" validate:"required"`
// A page of mount targets for the share.
MountTargets []ShareMountTarget `json:"mount_targets" validate:"required"`
// A link to the next page of resources. This property is present for all pages
// except the last page.
Next *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalShareMountTargetCollection unmarshals an instance of ShareMountTargetCollection from the specified map of raw messages.
func UnmarshalShareMountTargetCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareMountTargetCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTarget)
if err != nil {
err = core.SDKErrorf(err, "", "mount_targets-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ShareMountTargetCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ShareMountTargetPatch : ShareMountTargetPatch struct
type ShareMountTargetPatch struct {
// The name for this share mount target. The name must not be used by another mount target for the file share.
Name *string `json:"name,omitempty"`
}
// UnmarshalShareMountTargetPatch unmarshals an instance of ShareMountTargetPatch from the specified map of raw messages.
func UnmarshalShareMountTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareMountTargetPatch)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the ShareMountTargetPatch
func (shareMountTargetPatch *ShareMountTargetPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(shareMountTargetPatch.Name) {
_patch["name"] = shareMountTargetPatch.Name
}
return
}
// ShareMountTargetPrototype : ShareMountTargetPrototype struct
// Models which "extend" this model:
// - ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup
// - ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC
type ShareMountTargetPrototype struct {
// The name for this share mount target. The name must not be used by another mount target for the file share. If
// unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The transit encryption mode to use for this share mount target:
// - `none`: Not encrypted in transit.
// - `user_managed`: Encrypted in transit using an instance identity certificate. The
// `access_control_mode` for the share must be `security_group`.
//
// The specified value must be listed in the share's
// `allowed_transit_encryption_modes`.
TransitEncryption *string `json:"transit_encryption,omitempty"`
VirtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf `json:"virtual_network_interface,omitempty"`
// Identifies a VPC by a unique property.
VPC VPCIdentityIntf `json:"vpc,omitempty"`
}
// Constants associated with the ShareMountTargetPrototype.TransitEncryption property.
// The transit encryption mode to use for this share mount target:
// - `none`: Not encrypted in transit.
// - `user_managed`: Encrypted in transit using an instance identity certificate. The
// `access_control_mode` for the share must be `security_group`.
//
// The specified value must be listed in the share's
// `allowed_transit_encryption_modes`.
const (
ShareMountTargetPrototypeTransitEncryptionNoneConst = "none"
ShareMountTargetPrototypeTransitEncryptionUserManagedConst = "user_managed"
)
func (*ShareMountTargetPrototype) isaShareMountTargetPrototype() bool {
return true
}
type ShareMountTargetPrototypeIntf interface {
isaShareMountTargetPrototype() bool
}
// UnmarshalShareMountTargetPrototype unmarshals an instance of ShareMountTargetPrototype from the specified map of raw messages.
func UnmarshalShareMountTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareMountTargetPrototype)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption)
if err != nil {
err = core.SDKErrorf(err, "", "transit_encryption-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalShareMountTargetVirtualNetworkInterfacePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareMountTargetReference : ShareMountTargetReference struct
type ShareMountTargetReference struct {
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this share mount target.
Href *string `json:"href" validate:"required"`
// The unique identifier for this share mount target.
ID *string `json:"id" validate:"required"`
// The name for this share mount target. The name is unique across all mount targets for the file share.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the ShareMountTargetReference.ResourceType property.
// The resource type.
const (
ShareMountTargetReferenceResourceTypeShareMountTargetConst = "share_mount_target"
)
// UnmarshalShareMountTargetReference unmarshals an instance of ShareMountTargetReference from the specified map of raw messages.
func UnmarshalShareMountTargetReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareMountTargetReference)
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareMountTargetVirtualNetworkInterfacePrototype : ShareMountTargetVirtualNetworkInterfacePrototype struct
// Models which "extend" this model:
// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext
// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity
type ShareMountTargetVirtualNetworkInterfacePrototype 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"`
// Indicates whether this virtual network interface will be automatically deleted when
// `target` is deleted.
AutoDelete *bool `json:"auto_delete,omitempty"`
// If `true`:
// - The VPC infrastructure performs any needed NAT operations.
// - `floating_ips` must not have more than one floating IP.
//
// If `false`:
// - Packets are passed unchanged to/from the virtual network interface,
// allowing the workload to perform any needed NAT operations.
// - `allow_ip_spoofing` must be `false`.
// - Can only be attached to a `target` with a `resource_type` of
// `bare_metal_server_network_attachment`.
EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"`
// The additional IP addresses to bind to the virtual network interface. Each item may be either a reserved IP
// identity, or a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be
// in the primary IP's subnet.
//
// If reserved IP identities are provided, the specified reserved IPs must be unbound.
//
// If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network
// interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet
// will be automatically selected and reserved.
Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"`
// The name for this virtual network interface. The name must not be used by another virtual network interface in the
// VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are
// reserved for provider-owned resources, and are not allowed.
Name *string `json:"name,omitempty"`
// The primary IP address to bind to the virtual network interface. May be either a
// reserved IP identity, or a reserved IP prototype object which will be used to create a
// new reserved IP.
//
// If a reserved IP identity is provided, the specified reserved IP must be unbound.
//
// If a reserved IP prototype object with an address is provided, the address must be
// available on the virtual network interface's subnet. If no address is specified,
// an available address on the subnet will be automatically selected and reserved.
PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"`
// The protocol state filtering mode to use for this virtual network interface. If
// `auto`, protocol state packet filtering is enabled or disabled based on the virtual network interface's `target`
// resource type:
//
// - `bare_metal_server_network_attachment`: disabled
// - `instance_network_attachment`: enabled
// - `share_mount_target`: enabled
//
// Protocol state filtering monitors each network connection flowing over this virtual network interface, and drops any
// packets that are invalid based on the current connection state and protocol. See [Protocol state filtering
// mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information.
ProtocolStateFilteringMode *string `json:"protocol_state_filtering_mode,omitempty"`
// The resource group to use for this virtual network interface. If unspecified, the
// share's resource group will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC
// for the subnet is used.
SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"`
// The associated subnet. Required if `primary_ip` does not specify a reserved IP
// identity.
Subnet SubnetIdentityIntf `json:"subnet,omitempty"`
// The unique identifier for this virtual network interface.
ID *string `json:"id,omitempty"`
// The URL for this virtual network interface.
Href *string `json:"href,omitempty"`
// The CRN for this virtual network interface.
CRN *string `json:"crn,omitempty"`
}
// Constants associated with the ShareMountTargetVirtualNetworkInterfacePrototype.ProtocolStateFilteringMode property.
// The protocol state filtering mode to use for this virtual network interface. If
// `auto`, protocol state packet filtering is enabled or disabled based on the virtual network interface's `target`
// resource type:
//
// - `bare_metal_server_network_attachment`: disabled
// - `instance_network_attachment`: enabled
// - `share_mount_target`: enabled
//
// Protocol state filtering monitors each network connection flowing over this virtual network interface, and drops any
// packets that are invalid based on the current connection state and protocol. See [Protocol state filtering
// mode](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#protocol-state-filtering) for more information.
const (
ShareMountTargetVirtualNetworkInterfacePrototypeProtocolStateFilteringModeAutoConst = "auto"
ShareMountTargetVirtualNetworkInterfacePrototypeProtocolStateFilteringModeEnabledConst = "enabled"
)
func (*ShareMountTargetVirtualNetworkInterfacePrototype) isaShareMountTargetVirtualNetworkInterfacePrototype() bool {
return true
}
type ShareMountTargetVirtualNetworkInterfacePrototypeIntf interface {
isaShareMountTargetVirtualNetworkInterfacePrototype() bool
}
// UnmarshalShareMountTargetVirtualNetworkInterfacePrototype unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototype from the specified map of raw messages.
func UnmarshalShareMountTargetVirtualNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareMountTargetVirtualNetworkInterfacePrototype)
err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing)
if err != nil {
err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete)
if err != nil {
err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat)
if err != nil {
err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "ips-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "protocol_state_filtering_mode", &obj.ProtocolStateFilteringMode)
if err != nil {
err = core.SDKErrorf(err, "", "protocol_state_filtering_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SharePatch : SharePatch struct
type SharePatch struct {
// The access control mode for the share:
//
// - `security_group`: The security groups on the virtual network interface for a
// mount target control access to the mount target.
// - `vpc`: All clients in the VPC for a mount target have access to the mount target.
//
// For this property to be changed, the share must have no mount targets,
// `replication_role` must be `none` and `accessor_binding_role` must not be `accessor`.
AccessControlMode *string `json:"access_control_mode,omitempty"`
// The transit encryption modes to allow for this share
// (replacing the existing allowed transit encryption modes). The specified transit encryption modes must contain all
// transit_encryption modes specified by existing mount targets.
//
// For this property to be updated, the `accessor_binding_role` must be `none`.
AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes,omitempty"`
// The maximum input/output operations per second (IOPS) for the file share.
//
// The maximum IOPS for a share may increase in the future. For this property to be changed, the share
// `accessor_binding_role` must not be `accessor`, the share profile must not have an `iops.type` of `dependent` or
// `fixed`, and the specified value must be within the `iops` range of the share's profile supported by the share's
// size.
Iops *int64 `json:"iops,omitempty"`
// The name for this share. The name must not be used by another share in the region.
Name *string `json:"name,omitempty"`
// The profile to use for this file share.
//
// The requested profile must be in the same `family`.
Profile ShareProfileIdentityIntf `json:"profile,omitempty"`
// The cron specification for the file share replication schedule.
//
// Replication of a share can be scheduled to occur at most once every 15 minutes.
//
// For this property to be changed, the share `replication_role` must be `replica`.
ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"`
// The size of the file share (in gigabytes), excluding share snapshots. The value must not be less than the share's
// current size, and must not exceed the maximum supported by the share's profile and IOPS.
//
// For this property to be changed:
// - The share `lifecycle_state` must be `stable`
// - The share `replication_role` must not be `replica`
// - The share `accessor_binding_role` must not be `accessor`.
Size *int64 `json:"size,omitempty"`
// The tags for this resource.
UserTags []string `json:"user_tags,omitempty"`
}
// Constants associated with the SharePatch.AccessControlMode property.
// The access control mode for the share:
//
// - `security_group`: The security groups on the virtual network interface for a
// mount target control access to the mount target.
// - `vpc`: All clients in the VPC for a mount target have access to the mount target.
//
// For this property to be changed, the share must have no mount targets,
// `replication_role` must be `none` and `accessor_binding_role` must not be `accessor`.
const (
SharePatchAccessControlModeSecurityGroupConst = "security_group"
SharePatchAccessControlModeVPCConst = "vpc"
)
// Constants associated with the SharePatch.AllowedTransitEncryptionModes property.
const (
SharePatchAllowedTransitEncryptionModesNoneConst = "none"
SharePatchAllowedTransitEncryptionModesUserManagedConst = "user_managed"
)
// UnmarshalSharePatch unmarshals an instance of SharePatch from the specified map of raw messages.
func UnmarshalSharePatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SharePatch)
err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode)
if err != nil {
err = core.SDKErrorf(err, "", "access_control_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "allowed_transit_encryption_modes", &obj.AllowedTransitEncryptionModes)
if err != nil {
err = core.SDKErrorf(err, "", "allowed_transit_encryption_modes-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "iops", &obj.Iops)
if err != nil {
err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec)
if err != nil {
err = core.SDKErrorf(err, "", "replication_cron_spec-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "size", &obj.Size)
if err != nil {
err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags)
if err != nil {
err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the SharePatch
func (sharePatch *SharePatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(sharePatch.AccessControlMode) {
_patch["access_control_mode"] = sharePatch.AccessControlMode
}
if !core.IsNil(sharePatch.AllowedTransitEncryptionModes) {
_patch["allowed_transit_encryption_modes"] = sharePatch.AllowedTransitEncryptionModes
}
if !core.IsNil(sharePatch.Iops) {
_patch["iops"] = sharePatch.Iops
}
if !core.IsNil(sharePatch.Name) {
_patch["name"] = sharePatch.Name
}
if !core.IsNil(sharePatch.Profile) {
_patch["profile"] = sharePatch.Profile.asPatch()
}
if !core.IsNil(sharePatch.ReplicationCronSpec) {
_patch["replication_cron_spec"] = sharePatch.ReplicationCronSpec
}
if !core.IsNil(sharePatch.Size) {
_patch["size"] = sharePatch.Size
}
if !core.IsNil(sharePatch.UserTags) {
_patch["user_tags"] = sharePatch.UserTags
}
return
}
// ShareProfile : ShareProfile struct
type ShareProfile struct {
// The permitted capacity range (in gigabytes) for a share with this profile.
Capacity ShareProfileCapacityIntf `json:"capacity" validate:"required"`
// The product family this share profile belongs to.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Family *string `json:"family" validate:"required"`
// The URL for this share profile.
Href *string `json:"href" validate:"required"`
// The permitted IOPS range for a share with this profile.
Iops ShareProfileIopsIntf `json:"iops" validate:"required"`
// The globally unique name for this share profile.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the ShareProfile.Family property.
// The product family this share profile belongs to.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ShareProfileFamilyDefinedPerformanceConst = "defined_performance"
)
// Constants associated with the ShareProfile.ResourceType property.
// The resource type.
const (
ShareProfileResourceTypeShareProfileConst = "share_profile"
)
// UnmarshalShareProfile unmarshals an instance of ShareProfile from the specified map of raw messages.
func UnmarshalShareProfile(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareProfile)
err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalShareProfileCapacity)
if err != nil {
err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "family", &obj.Family)
if err != nil {
err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "iops", &obj.Iops, UnmarshalShareProfileIops)
if err != nil {
err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareProfileCapacity : ShareProfileCapacity struct
// Models which "extend" this model:
// - ShareProfileCapacityFixed
// - ShareProfileCapacityEnum
// - ShareProfileCapacityRange
// - ShareProfileCapacityDependentRange
type ShareProfileCapacity struct {
// The type for this profile field.
Type *string `json:"type,omitempty"`
// The value for this profile field.
Value *int64 `json:"value,omitempty"`
// The permitted values for this profile field.
Values []int64 `json:"values,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"`
}
// Constants associated with the ShareProfileCapacity.Type property.
// The type for this profile field.
const (
ShareProfileCapacityTypeFixedConst = "fixed"
)
func (*ShareProfileCapacity) isaShareProfileCapacity() bool {
return true
}
type ShareProfileCapacityIntf interface {
isaShareProfileCapacity() bool
}
// UnmarshalShareProfileCapacity unmarshals an instance of ShareProfileCapacity from the specified map of raw messages.
func UnmarshalShareProfileCapacity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareProfileCapacity)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareProfileCollection : ShareProfileCollection struct
type ShareProfileCollection struct {
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of share profiles.
Profiles []ShareProfile `json:"profiles" validate:"required"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalShareProfileCollection unmarshals an instance of ShareProfileCollection from the specified map of raw messages.
func UnmarshalShareProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareProfileCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalShareProfile)
if err != nil {
err = core.SDKErrorf(err, "", "profiles-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ShareProfileCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ShareProfileIops : ShareProfileIops struct
// Models which "extend" this model:
// - ShareProfileIopsFixed
// - ShareProfileIopsRange
// - ShareProfileIopsEnum
// - ShareProfileIopsDependentRange
// - ShareProfileIopsDependent
type ShareProfileIops 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 ShareProfileIops.Type property.
// The type for this profile field.
const (
ShareProfileIopsTypeFixedConst = "fixed"
)
func (*ShareProfileIops) isaShareProfileIops() bool {
return true
}
type ShareProfileIopsIntf interface {
isaShareProfileIops() bool
}
// UnmarshalShareProfileIops unmarshals an instance of ShareProfileIops from the specified map of raw messages.
func UnmarshalShareProfileIops(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareProfileIops)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "default", &obj.Default)
if err != nil {
err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "max", &obj.Max)
if err != nil {
err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "min", &obj.Min)
if err != nil {
err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "step", &obj.Step)
if err != nil {
err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "values", &obj.Values)
if err != nil {
err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareProfileIdentity : Identifies a share profile by a unique property.
// Models which "extend" this model:
// - ShareProfileIdentityByName
// - ShareProfileIdentityByHref
type ShareProfileIdentity struct {
// The globally unique name for this share profile.
Name *string `json:"name,omitempty"`
// The URL for this share profile.
Href *string `json:"href,omitempty"`
}
func (*ShareProfileIdentity) isaShareProfileIdentity() bool {
return true
}
type ShareProfileIdentityIntf interface {
isaShareProfileIdentity() bool
asPatch() map[string]interface{}
}
// UnmarshalShareProfileIdentity unmarshals an instance of ShareProfileIdentity from the specified map of raw messages.
func UnmarshalShareProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareProfileIdentity)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the ShareProfileIdentity
func (shareProfileIdentity *ShareProfileIdentity) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(shareProfileIdentity.Name) {
_patch["name"] = shareProfileIdentity.Name
}
if !core.IsNil(shareProfileIdentity.Href) {
_patch["href"] = shareProfileIdentity.Href
}
return
}
// ShareProfileReference : ShareProfileReference struct
type ShareProfileReference struct {
// The URL for this share profile.
Href *string `json:"href" validate:"required"`
// The globally unique name for this share profile.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the ShareProfileReference.ResourceType property.
// The resource type.
const (
ShareProfileReferenceResourceTypeShareProfileConst = "share_profile"
)
// UnmarshalShareProfileReference unmarshals an instance of ShareProfileReference from the specified map of raw messages.
func UnmarshalShareProfileReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareProfileReference)
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SharePrototype : SharePrototype struct
// Models which "extend" this model:
// - SharePrototypeShareBySize
// - SharePrototypeShareBySourceShare
// - SharePrototypeShareByOriginShare
// - SharePrototypeShareBySourceSnapshot
type SharePrototype struct {
// The transit encryption modes to allow for this share. If unspecified:
// - If share mount targets are specified, and those share mount targets all specify a
// `transit_encryption` of `user_managed`, then only `user_managed` will be allowed.
// - Otherwise, all `transit_encryption` modes will be allowed.
AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes,omitempty"`
// The mount targets for the file share. Each mount target must be in a unique VPC.
MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"`
// The name for this share. The name must not be used by another share in the region. If unspecified, the name will be
// a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// Configuration for a replica file share to create and associate with this file share. If
// unspecified, a replica may be subsequently added by creating a new file share with a
// `source_share` referencing this file share.
ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"`
// The tags for this resource.
UserTags []string `json:"user_tags,omitempty"`
// The access control mode for the share:
//
// - `security_group`: The security groups on the virtual network interface for a
// mount target control access to the mount target. Mount targets for this share
// require a virtual network interface.
// - `vpc`: All clients in the VPC for a mount target have access to the mount target.
// Mount targets for this share require a VPC.
AccessControlMode *string `json:"access_control_mode,omitempty"`
// The root key to use to wrap the data encryption key for the share.
//
// If unspecified, the `encryption` type for the share will be `provider_managed`.
//
// The specified key may be in a different account, subject to IAM policies.
EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"`
// The owner assigned to the file share at creation. Subsequent changes to the owner
// must be performed by a client that has mounted the file share.
InitialOwner *ShareInitialOwner `json:"initial_owner,omitempty"`
// The maximum input/output operations per second (IOPS) for the file share.
//
// If the share profile has an `iops.type` of `dependent` or `fixed`, this property is system-managed and must not be
// specified. Otherwise, the specified value must be within the `iops` range of the share profile as supported by the
// share's specified size.
Iops *int64 `json:"iops,omitempty"`
// The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use
// for this file share. The profile must support the share's specified IOPS and size.
Profile ShareProfileIdentityIntf `json:"profile,omitempty"`
// The resource group to use. If unspecified, the account's [default resource
// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The size of the file share (in gigabytes), excluding share snapshots.
//
// The specified value must be within the permitted `capacity` range of the share's profile and supported by the
// share's specified IOPS.
Size *int64 `json:"size,omitempty"`
// The zone this file share will reside in. For a replica share in the same region as
// the source share, this must be a different zone from the source share.
Zone ZoneIdentityIntf `json:"zone,omitempty"`
// The cron specification for the file share replication schedule.
//
// Replication of a share can be scheduled to occur at most once every 15 minutes.
//
// The scheduling frequency for this property may
// [increase](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"`
// The source file share for this replica file share. The specified file share must not
// already have a replica, and must not be a replica. If source file share is specified
// by CRN, it may be in an [associated partner
// region](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-replication).
SourceShare ShareIdentityIntf `json:"source_share,omitempty"`
// The origin share for the accessor share. The origin share must have an
// `access_control_mode` of `security_group`, and must not have an
// `accessor_binding_role` of `accessor`.
//
// The specified share may be in a different account, subject to IAM policies.
OriginShare ShareIdentityIntf `json:"origin_share,omitempty"`
// The source snapshot to clone this file share from.
//
// This file share will reside in the same zone as the specified source snapshot.
// The snapshot must have the `lifecycle_state` as `stable` and `status` as `available`
// to be able to restore a share for it.
SourceSnapshot ShareSourceSnapshotPrototypeIntf `json:"source_snapshot,omitempty"`
}
// Constants associated with the SharePrototype.AllowedTransitEncryptionModes property.
const (
SharePrototypeAllowedTransitEncryptionModesNoneConst = "none"
SharePrototypeAllowedTransitEncryptionModesUserManagedConst = "user_managed"
)
// Constants associated with the SharePrototype.AccessControlMode property.
// The access control mode for the share:
//
// - `security_group`: The security groups on the virtual network interface for a
// mount target control access to the mount target. Mount targets for this share
// require a virtual network interface.
// - `vpc`: All clients in the VPC for a mount target have access to the mount target.
// Mount targets for this share require a VPC.
const (
SharePrototypeAccessControlModeSecurityGroupConst = "security_group"
SharePrototypeAccessControlModeVPCConst = "vpc"
)
func (*SharePrototype) isaSharePrototype() bool {
return true
}
type SharePrototypeIntf interface {
isaSharePrototype() bool
}
// UnmarshalSharePrototype unmarshals an instance of SharePrototype from the specified map of raw messages.
func UnmarshalSharePrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SharePrototype)
err = core.UnmarshalPrimitive(m, "allowed_transit_encryption_modes", &obj.AllowedTransitEncryptionModes)
if err != nil {
err = core.SDKErrorf(err, "", "allowed_transit_encryption_modes-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "mount_targets-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext)
if err != nil {
err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags)
if err != nil {
err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode)
if err != nil {
err = core.SDKErrorf(err, "", "access_control_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "initial_owner", &obj.InitialOwner, UnmarshalShareInitialOwner)
if err != nil {
err = core.SDKErrorf(err, "", "initial_owner-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "iops", &obj.Iops)
if err != nil {
err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "size", &obj.Size)
if err != nil {
err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec)
if err != nil {
err = core.SDKErrorf(err, "", "replication_cron_spec-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "source_share-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "origin_share", &obj.OriginShare, UnmarshalShareIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "origin_share-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalShareSourceSnapshotPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SharePrototypeShareContext : Configuration for a replica file share to create and associate with this file share. If unspecified, a replica may be
// subsequently added by creating a new file share with a
// `source_share` referencing this file share.
type SharePrototypeShareContext struct {
// The transit encryption modes to allow for this share. If unspecified:
// - If share mount targets are specified, and those share mount targets all specify a
// `transit_encryption` of `user_managed`, then only `user_managed` will be allowed.
// - Otherwise, all `transit_encryption` modes will be allowed.
AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes,omitempty"`
// The maximum input/output operations per second (IOPS) for the file share.
//
// If the share profile has an `iops.type` of `dependent` or `fixed`, this property is system-managed and must not be
// specified. Otherwise, the specified value must be within the `iops` range of the share profile as supported by the
// share's specified size.
Iops *int64 `json:"iops,omitempty"`
// The mount targets for this replica file share. Each mount target must be in a unique VPC.
//
// A replica's mount targets must be mounted read-only.
MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"`
// The name for this share. The name must not be used by another share in the region. If unspecified, the name will be
// a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use
// for this file share. The profile must support the share's specified IOPS and size.
Profile ShareProfileIdentityIntf `json:"profile" validate:"required"`
// The cron specification for the file share replication schedule.
//
// Replication of a share can be scheduled to occur at most once every 15 minutes.
ReplicationCronSpec *string `json:"replication_cron_spec" validate:"required"`
// The resource group to use. If unspecified, the resource group from
// the source share will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The tags for this resource.
UserTags []string `json:"user_tags,omitempty"`
// The zone this replica file share will reside in. For a replica share in the same
// region as the source share, this must be a different zone from the source share.
Zone ZoneIdentityIntf `json:"zone" validate:"required"`
}
// Constants associated with the SharePrototypeShareContext.AllowedTransitEncryptionModes property.
const (
SharePrototypeShareContextAllowedTransitEncryptionModesNoneConst = "none"
SharePrototypeShareContextAllowedTransitEncryptionModesUserManagedConst = "user_managed"
)
// NewSharePrototypeShareContext : Instantiate SharePrototypeShareContext (Generic Model Constructor)
func (*VpcV1) NewSharePrototypeShareContext(profile ShareProfileIdentityIntf, replicationCronSpec string, zone ZoneIdentityIntf) (_model *SharePrototypeShareContext, err error) {
_model = &SharePrototypeShareContext{
Profile: profile,
ReplicationCronSpec: core.StringPtr(replicationCronSpec),
Zone: zone,
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalSharePrototypeShareContext unmarshals an instance of SharePrototypeShareContext from the specified map of raw messages.
func UnmarshalSharePrototypeShareContext(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SharePrototypeShareContext)
err = core.UnmarshalPrimitive(m, "allowed_transit_encryption_modes", &obj.AllowedTransitEncryptionModes)
if err != nil {
err = core.SDKErrorf(err, "", "allowed_transit_encryption_modes-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "iops", &obj.Iops)
if err != nil {
err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "mount_targets-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec)
if err != nil {
err = core.SDKErrorf(err, "", "replication_cron_spec-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags)
if err != nil {
err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareReference : ShareReference struct
type ShareReference struct {
// The CRN for this file share.
CRN *string `json:"crn" validate:"required"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this file share.
Href *string `json:"href" validate:"required"`
// The unique identifier for this file share.
ID *string `json:"id" validate:"required"`
// The name for this share. The name is unique across all shares in the region.
Name *string `json:"name" validate:"required"`
// If present, this property indicates that the resource associated with this reference
// is remote and therefore may not be directly retrievable.
Remote *ShareRemote `json:"remote,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the ShareReference.ResourceType property.
// The resource type.
const (
ShareReferenceResourceTypeShareConst = "share"
)
// UnmarshalShareReference unmarshals an instance of ShareReference from the specified map of raw messages.
func UnmarshalShareReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareReference)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalShareRemote)
if err != nil {
err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not
// be directly retrievable.
type ShareRemote struct {
// If present, this property indicates that the referenced resource is remote to this
// account, and identifies the owning account.
Account *AccountReference `json:"account,omitempty"`
// If present, this property indicates that the referenced resource is remote to this
// region, and identifies the native region.
Region *RegionReference `json:"region,omitempty"`
}
// UnmarshalShareRemote unmarshals an instance of ShareRemote from the specified map of raw messages.
func UnmarshalShareRemote(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareRemote)
err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference)
if err != nil {
err = core.SDKErrorf(err, "", "account-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference)
if err != nil {
err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareReplicationStatusReason : ShareReplicationStatusReason struct
type ShareReplicationStatusReason struct {
// A snake case string succinctly identifying the status reason.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the status reason.
Message *string `json:"message" validate:"required"`
// A link to documentation about this status reason.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the ShareReplicationStatusReason.Code property.
// A snake case string succinctly identifying the status reason.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ShareReplicationStatusReasonCodeCannotInitializeReplicationConst = "cannot_initialize_replication"
ShareReplicationStatusReasonCodeCannotReachReplicaShareConst = "cannot_reach_replica_share"
ShareReplicationStatusReasonCodeCannotReachSourceShareConst = "cannot_reach_source_share"
)
// UnmarshalShareReplicationStatusReason unmarshals an instance of ShareReplicationStatusReason from the specified map of raw messages.
func UnmarshalShareReplicationStatusReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareReplicationStatusReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareSnapshot : ShareSnapshot struct
type ShareSnapshot struct {
// If present, the backup policy plan which created this share snapshot.
BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan,omitempty"`
// The date and time the data capture for this share snapshot was completed.
//
// If absent, this snapshot's data has not yet been captured.
CapturedAt *strfmt.DateTime `json:"captured_at,omitempty"`
// The date and time that the share snapshot was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The CRN for this share snapshot.
CRN *string `json:"crn" validate:"required"`
// The fingerprint for this share snapshot. Only snapshots with identical data will have the same fingerprint. This
// snapshot will also be available as a subdirectory named identically to this fingerprint in the share's `.snapshot`
// directory.
Fingerprint *string `json:"fingerprint" validate:"required"`
// The URL for this share snapshot.
Href *string `json:"href" validate:"required"`
// The unique identifier for this share snapshot.
ID *string `json:"id" validate:"required"`
// The reasons for the current `lifecycle_state` (if any).
LifecycleReasons []ShareSnapshotLifecycleReason `json:"lifecycle_reasons" validate:"required"`
// The lifecycle state of this share snapshot
// - `pending`: The share snapshot is being provisioned and is not yet usable. A
// snapshot on a replica share will remain `pending` until the next replication sync
// completes.
// - `deleting`: The share snapshot is being deleted.
// - `failed`: The share snapshot is irrecoverably unusable.
// - `stable`: The share snapshot is stable and ready for use.
// - `updating`: The share snapshot is being updated.
// - `suspended`: The share snapshot is not currently usable (see `lifecycle_reasons`).
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The minimum size of a share created from this snapshot. When a snapshot is created, this will be set to the size of
// the `source_share`.
MinimumSize *int64 `json:"minimum_size" validate:"required"`
// The name for this share snapshot. The name is unique across all snapshots for the file share.
Name *string `json:"name" validate:"required"`
// The resource group for this share snapshot.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The status of the share snapshot:
// - `available`: The share snapshot is available for use.
// - `failed`: The share snapshot is irrecoverably unusable.
// - `pending`: The share snapshot is being provisioned and is not yet usable. A
// snapshot on a replica share will remain `pending` until the next replication sync
// completes.
// - `unusable`: The share snapshot is not currently usable (see `status_reasons`)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
// The reasons for the current status (if any).
StatusReasons []ShareSnapshotStatusReason `json:"status_reasons" validate:"required"`
// The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this share snapshot.
UserTags []string `json:"user_tags" validate:"required"`
// The zone this share snapshot resides in.
Zone *ZoneReference `json:"zone" validate:"required"`
}
// Constants associated with the ShareSnapshot.LifecycleState property.
// The lifecycle state of this share snapshot
// - `pending`: The share snapshot is being provisioned and is not yet usable. A
// snapshot on a replica share will remain `pending` until the next replication sync
// completes.
// - `deleting`: The share snapshot is being deleted.
// - `failed`: The share snapshot is irrecoverably unusable.
// - `stable`: The share snapshot is stable and ready for use.
// - `updating`: The share snapshot is being updated.
// - `suspended`: The share snapshot is not currently usable (see `lifecycle_reasons`).
const (
ShareSnapshotLifecycleStateDeletingConst = "deleting"
ShareSnapshotLifecycleStateFailedConst = "failed"
ShareSnapshotLifecycleStatePendingConst = "pending"
ShareSnapshotLifecycleStateStableConst = "stable"
ShareSnapshotLifecycleStateSuspendedConst = "suspended"
ShareSnapshotLifecycleStateUpdatingConst = "updating"
ShareSnapshotLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the ShareSnapshot.ResourceType property.
// The resource type.
const (
ShareSnapshotResourceTypeShareSnapshotConst = "share_snapshot"
)
// Constants associated with the ShareSnapshot.Status property.
// The status of the share snapshot:
// - `available`: The share snapshot is available for use.
// - `failed`: The share snapshot is irrecoverably unusable.
// - `pending`: The share snapshot is being provisioned and is not yet usable. A
// snapshot on a replica share will remain `pending` until the next replication sync
// completes.
// - `unusable`: The share snapshot is not currently usable (see `status_reasons`)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ShareSnapshotStatusAvailableConst = "available"
ShareSnapshotStatusFailedConst = "failed"
ShareSnapshotStatusPendingConst = "pending"
ShareSnapshotStatusUnusableConst = "unusable"
)
// UnmarshalShareSnapshot unmarshals an instance of ShareSnapshot from the specified map of raw messages.
func UnmarshalShareSnapshot(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareSnapshot)
err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference)
if err != nil {
err = core.SDKErrorf(err, "", "backup_policy_plan-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "captured_at", &obj.CapturedAt)
if err != nil {
err = core.SDKErrorf(err, "", "captured_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint)
if err != nil {
err = core.SDKErrorf(err, "", "fingerprint-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalShareSnapshotLifecycleReason)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "minimum_size", &obj.MinimumSize)
if err != nil {
err = core.SDKErrorf(err, "", "minimum_size-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalShareSnapshotStatusReason)
if err != nil {
err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags)
if err != nil {
err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareSnapshotCollection : ShareSnapshotCollection struct
type ShareSnapshotCollection struct {
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of share snapshots.
Snapshots []ShareSnapshot `json:"snapshots,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalShareSnapshotCollection unmarshals an instance of ShareSnapshotCollection from the specified map of raw messages.
func UnmarshalShareSnapshotCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareSnapshotCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalShareSnapshot)
if err != nil {
err = core.SDKErrorf(err, "", "snapshots-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *ShareSnapshotCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// ShareSnapshotLifecycleReason : ShareSnapshotLifecycleReason struct
type ShareSnapshotLifecycleReason struct {
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this lifecycle state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this lifecycle state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the ShareSnapshotLifecycleReason.Code property.
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ShareSnapshotLifecycleReasonCodeInternalErrorConst = "internal_error"
ShareSnapshotLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider"
)
// UnmarshalShareSnapshotLifecycleReason unmarshals an instance of ShareSnapshotLifecycleReason from the specified map of raw messages.
func UnmarshalShareSnapshotLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareSnapshotLifecycleReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareSnapshotPatch : ShareSnapshotPatch struct
type ShareSnapshotPatch struct {
// The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this share snapshot.
UserTags []string `json:"user_tags,omitempty"`
}
// UnmarshalShareSnapshotPatch unmarshals an instance of ShareSnapshotPatch from the specified map of raw messages.
func UnmarshalShareSnapshotPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareSnapshotPatch)
err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags)
if err != nil {
err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the ShareSnapshotPatch
func (shareSnapshotPatch *ShareSnapshotPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(shareSnapshotPatch.UserTags) {
_patch["user_tags"] = shareSnapshotPatch.UserTags
}
return
}
// ShareSnapshotStatusReason : ShareSnapshotStatusReason struct
type ShareSnapshotStatusReason struct {
// A reason code for the status:
// - `encryption_key_deleted`: Share snapshot is unusable because its
// `encryption_key` was deleted
// - `internal_error`: Internal error (contact IBM support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the status reason.
Message *string `json:"message" validate:"required"`
// A link to documentation about this status reason.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the ShareSnapshotStatusReason.Code property.
// A reason code for the status:
// - `encryption_key_deleted`: Share snapshot is unusable because its
// `encryption_key` was deleted
// - `internal_error`: Internal error (contact IBM support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
ShareSnapshotStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted"
)
// UnmarshalShareSnapshotStatusReason unmarshals an instance of ShareSnapshotStatusReason from the specified map of raw messages.
func UnmarshalShareSnapshotStatusReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareSnapshotStatusReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareSourceSnapshot : ShareSourceSnapshot struct
// Models which "extend" this model:
// - ShareSourceSnapshotShareSnapshotReference
type ShareSourceSnapshot struct {
// The CRN for this share snapshot.
CRN *string `json:"crn,omitempty"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this share snapshot.
Href *string `json:"href,omitempty"`
// The unique identifier for this share snapshot.
ID *string `json:"id,omitempty"`
// The name for this share snapshot. The name is unique across all snapshots for the file share.
Name *string `json:"name,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type,omitempty"`
}
// Constants associated with the ShareSourceSnapshot.ResourceType property.
// The resource type.
const (
ShareSourceSnapshotResourceTypeShareSnapshotConst = "share_snapshot"
)
func (*ShareSourceSnapshot) isaShareSourceSnapshot() bool {
return true
}
type ShareSourceSnapshotIntf interface {
isaShareSourceSnapshot() bool
}
// UnmarshalShareSourceSnapshot unmarshals an instance of ShareSourceSnapshot from the specified map of raw messages.
func UnmarshalShareSourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareSourceSnapshot)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// ShareSourceSnapshotPrototype : ShareSourceSnapshotPrototype struct
// Models which "extend" this model:
// - ShareSourceSnapshotPrototypeShareSnapshotIdentity
type ShareSourceSnapshotPrototype struct {
// The unique identifier for this share snapshot.
ID *string `json:"id,omitempty"`
// The CRN for this share snapshot.
CRN *string `json:"crn,omitempty"`
// The URL for this share snapshot.
Href *string `json:"href,omitempty"`
}
func (*ShareSourceSnapshotPrototype) isaShareSourceSnapshotPrototype() bool {
return true
}
type ShareSourceSnapshotPrototypeIntf interface {
isaShareSourceSnapshotPrototype() bool
}
// UnmarshalShareSourceSnapshotPrototype unmarshals an instance of ShareSourceSnapshotPrototype from the specified map of raw messages.
func UnmarshalShareSourceSnapshotPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(ShareSourceSnapshotPrototype)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Snapshot : Snapshot struct
type Snapshot struct {
// The usage constraints to be matched against the requested instance properties to
// determine compatibility. While bare metal servers cannot be provisioned from snapshots,
// an image or volume created from this snapshot will inherit its `allowed_use` value.
//
// Only present on bootable snapshots. The value of this property will be inherited from
// the source volume or source snapshot at snapshot creation, but can be changed.
AllowedUse *SnapshotAllowedUse `json:"allowed_use,omitempty"`
// If present, the backup policy plan which created this snapshot.
BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan,omitempty"`
// Indicates if a boot volume attachment can be created with a volume created from this snapshot.
Bootable *bool `json:"bootable" validate:"required"`
// The date and time the data capture for this snapshot was completed.
//
// If absent, this snapshot's data has not yet been captured. Additionally, this property may be absent for snapshots
// created before 1 January 2022.
CapturedAt *strfmt.DateTime `json:"captured_at,omitempty"`
// The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user)
// offering inherited from the snapshot's source. If a virtual server instance is
// provisioned with a `source_snapshot` specifying this snapshot, the virtual server
// instance will use this snapshot's catalog offering, including its pricing plan.
//
// If absent, this snapshot is not associated with a catalog offering.
CatalogOffering *SnapshotCatalogOffering `json:"catalog_offering,omitempty"`
// The clones for this snapshot.
Clones []SnapshotClone `json:"clones" validate:"required"`
// The copies of this snapshot.
Copies []SnapshotCopiesItem `json:"copies" validate:"required"`
// The date and time that this snapshot was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The CRN of this snapshot.
CRN *string `json:"crn" validate:"required"`
// Indicates whether this snapshot can be deleted. This value will always be `true`.
// Deprecated: this field is deprecated and may be removed in a future release.
Deletable *bool `json:"deletable" validate:"required"`
// The type of encryption used on the source volume.
Encryption *string `json:"encryption" validate:"required"`
// The root key used to wrap the data encryption key for the source 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 snapshot.
Href *string `json:"href" validate:"required"`
// The unique identifier for this snapshot.
ID *string `json:"id" validate:"required"`
// The lifecycle state of this snapshot.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The minimum capacity of a volume created from this snapshot. When a snapshot is created, this will be set to the
// capacity of the `source_volume`.
MinimumCapacity *int64 `json:"minimum_capacity" validate:"required"`
// The name for this snapshot. The name is unique across all snapshots in the region.
Name *string `json:"name" validate:"required"`
// The operating system included in this snapshot.
OperatingSystem *OperatingSystem `json:"operating_system,omitempty"`
// Indicates the progress (as a percentage) of storing this snapshot. Only stored snapshots can be used for
// restoration.
Progress *int64 `json:"progress" validate:"required"`
// The resource group for this snapshot.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) prefixed with `is.snapshot:` associated with
// this snapshot.
ServiceTags []string `json:"service_tags" validate:"required"`
// The size of this snapshot rounded up to the next gigabyte.
Size *int64 `json:"size" validate:"required"`
// If present, the snapshot consistency group which created this snapshot.
SnapshotConsistencyGroup *SnapshotConsistencyGroupReference `json:"snapshot_consistency_group,omitempty"`
// If present, the image from which the data on this snapshot was most directly
// provisioned.
SourceImage *ImageReference `json:"source_image,omitempty"`
// If present, the source snapshot this snapshot was created from.
SourceSnapshot *SnapshotSourceSnapshot `json:"source_snapshot,omitempty"`
// The source volume this snapshot was created from (may be
// [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)).
SourceVolume *VolumeReference `json:"source_volume" validate:"required"`
// The [storage
// generation](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles&interface=api#using-api-iops-profiles):
// - `1`: The first storage generation
// - `2`: The second storage generation
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
StorageGeneration *int64 `json:"storage_generation" validate:"required"`
// The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot.
UserTags []string `json:"user_tags" validate:"required"`
}
// Constants associated with the Snapshot.Encryption property.
// The type of encryption used on the source volume.
const (
SnapshotEncryptionProviderManagedConst = "provider_managed"
SnapshotEncryptionUserManagedConst = "user_managed"
)
// Constants associated with the Snapshot.LifecycleState property.
// The lifecycle state of this snapshot.
const (
SnapshotLifecycleStateDeletingConst = "deleting"
SnapshotLifecycleStateFailedConst = "failed"
SnapshotLifecycleStatePendingConst = "pending"
SnapshotLifecycleStateStableConst = "stable"
SnapshotLifecycleStateSuspendedConst = "suspended"
SnapshotLifecycleStateUnusableConst = "unusable"
SnapshotLifecycleStateUpdatingConst = "updating"
SnapshotLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the Snapshot.ResourceType property.
// The resource type.
const (
SnapshotResourceTypeSnapshotConst = "snapshot"
)
// UnmarshalSnapshot unmarshals an instance of Snapshot from the specified map of raw messages.
func UnmarshalSnapshot(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(Snapshot)
err = core.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalSnapshotAllowedUse)
if err != nil {
err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference)
if err != nil {
err = core.SDKErrorf(err, "", "backup_policy_plan-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "bootable", &obj.Bootable)
if err != nil {
err = core.SDKErrorf(err, "", "bootable-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "captured_at", &obj.CapturedAt)
if err != nil {
err = core.SDKErrorf(err, "", "captured_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalSnapshotCatalogOffering)
if err != nil {
err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClone)
if err != nil {
err = core.SDKErrorf(err, "", "clones-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "copies", &obj.Copies, UnmarshalSnapshotCopiesItem)
if err != nil {
err = core.SDKErrorf(err, "", "copies-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "deletable", &obj.Deletable)
if err != nil {
err = core.SDKErrorf(err, "", "deletable-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption)
if err != nil {
err = core.SDKErrorf(err, "", "encryption-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference)
if err != nil {
err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "minimum_capacity", &obj.MinimumCapacity)
if err != nil {
err = core.SDKErrorf(err, "", "minimum_capacity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem)
if err != nil {
err = core.SDKErrorf(err, "", "operating_system-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "progress", &obj.Progress)
if err != nil {
err = core.SDKErrorf(err, "", "progress-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "service_tags", &obj.ServiceTags)
if err != nil {
err = core.SDKErrorf(err, "", "service_tags-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "size", &obj.Size)
if err != nil {
err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "snapshot_consistency_group", &obj.SnapshotConsistencyGroup, UnmarshalSnapshotConsistencyGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "snapshot_consistency_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "source_image", &obj.SourceImage, UnmarshalImageReference)
if err != nil {
err = core.SDKErrorf(err, "", "source_image-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotSourceSnapshot)
if err != nil {
err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference)
if err != nil {
err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "storage_generation", &obj.StorageGeneration)
if err != nil {
err = core.SDKErrorf(err, "", "storage_generation-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags)
if err != nil {
err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SnapshotAllowedUse : SnapshotAllowedUse struct
type SnapshotAllowedUse struct {
// The API version with which to evaluate the expressions.
ApiVersion *string `json:"api_version" validate:"required"`
// The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in
// this snapshot.
//
// The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
// but does not support built-in functions and macros. In addition, the following variable is supported, corresponding
// to the `BareMetalServer` property:
// - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
BareMetalServer *string `json:"bare_metal_server" validate:"required"`
// The expression that must be satisfied by the properties of a virtual server instance provisioned using this
// snapshot.
//
// The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
// but does not support built-in functions and macros. In addition, the following variables are supported,
// corresponding to `Instance` properties:
// - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
// - `gpu.count` (integer): The number of GPUs
// - `gpu.manufacturer` (string): The GPU manufacturer
// - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes)
// - `gpu.model` (string): The GPU model.
Instance *string `json:"instance" validate:"required"`
}
// UnmarshalSnapshotAllowedUse unmarshals an instance of SnapshotAllowedUse from the specified map of raw messages.
func UnmarshalSnapshotAllowedUse(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotAllowedUse)
err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion)
if err != nil {
err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer)
if err != nil {
err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "instance", &obj.Instance)
if err != nil {
err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SnapshotAllowedUsePatch : SnapshotAllowedUsePatch struct
type SnapshotAllowedUsePatch struct {
// The API version with which to evaluate the expressions.
//
// If specified, the value must be between `2019-01-01` and today's date (in UTC).
ApiVersion *string `json:"api_version,omitempty"`
// The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in
// this snapshot.
//
// The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
// but does not support built-in functions and macros. In addition, the following variable is supported, corresponding
// to the `BareMetalServer` property:
// - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
BareMetalServer *string `json:"bare_metal_server,omitempty"`
// The expression that must be satisfied by the properties of a virtual server instance provisioned using this
// snapshot.
//
// The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
// but does not support built-in functions and macros. In addition, the following variables are supported,
// corresponding to `Instance` properties:
// - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
// - `gpu.count` (integer): The number of GPUs
// - `gpu.manufacturer` (string): The GPU manufacturer
// - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes)
// - `gpu.model` (string): The GPU model.
Instance *string `json:"instance,omitempty"`
}
// UnmarshalSnapshotAllowedUsePatch unmarshals an instance of SnapshotAllowedUsePatch from the specified map of raw messages.
func UnmarshalSnapshotAllowedUsePatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotAllowedUsePatch)
err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion)
if err != nil {
err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer)
if err != nil {
err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "instance", &obj.Instance)
if err != nil {
err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the SnapshotAllowedUsePatch
func (snapshotAllowedUsePatch *SnapshotAllowedUsePatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(snapshotAllowedUsePatch.ApiVersion) {
_patch["api_version"] = snapshotAllowedUsePatch.ApiVersion
}
if !core.IsNil(snapshotAllowedUsePatch.BareMetalServer) {
_patch["bare_metal_server"] = snapshotAllowedUsePatch.BareMetalServer
}
if !core.IsNil(snapshotAllowedUsePatch.Instance) {
_patch["instance"] = snapshotAllowedUsePatch.Instance
}
return
}
// SnapshotAllowedUsePrototype : SnapshotAllowedUsePrototype struct
type SnapshotAllowedUsePrototype struct {
// The API version with which to evaluate the expressions.
//
// If specified, the value must be between `2019-01-01` and today's date (in UTC). If unspecified, the `version` query
// parameter value will be used.
ApiVersion *string `json:"api_version,omitempty"`
// The expression that must be satisfied by the properties of a bare metal server provisioned using the image data in
// this snapshot.
//
// If unspecified, the expression will be set to `true`.
//
// The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
// but does not support built-in functions and macros. In addition, the following variable is supported, corresponding
// to the `BareMetalServer` property:
// - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled.
BareMetalServer *string `json:"bare_metal_server,omitempty"`
// The expression that must be satisfied by the properties of a virtual server instance provisioned using this
// snapshot.
//
// If unspecified, the expression will be set to `true`.
//
// The expression follows [Common Expression Language](https://github.com/google/cel-spec/blob/master/doc/langdef.md),
// but does not support built-in functions and macros. In addition, the following variables are supported,
// corresponding to `Instance` properties:
// - `enable_secure_boot` (boolean): Indicates whether secure boot is enabled
// - `gpu.count` (integer): The number of GPUs
// - `gpu.manufacturer` (string): The GPU manufacturer
// - `gpu.memory` (integer): The overall amount of GPU memory in GiB (gibibytes)
// - `gpu.model` (string): The GPU model.
Instance *string `json:"instance,omitempty"`
}
// UnmarshalSnapshotAllowedUsePrototype unmarshals an instance of SnapshotAllowedUsePrototype from the specified map of raw messages.
func UnmarshalSnapshotAllowedUsePrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotAllowedUsePrototype)
err = core.UnmarshalPrimitive(m, "api_version", &obj.ApiVersion)
if err != nil {
err = core.SDKErrorf(err, "", "api_version-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "bare_metal_server", &obj.BareMetalServer)
if err != nil {
err = core.SDKErrorf(err, "", "bare_metal_server-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "instance", &obj.Instance)
if err != nil {
err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SnapshotCatalogOffering : SnapshotCatalogOffering struct
type SnapshotCatalogOffering struct {
// The billing plan associated with the catalog offering version.
//
// If absent, no billing plan is associated with the catalog offering version
// (free).
Plan *CatalogOfferingVersionPlanReference `json:"plan,omitempty"`
// The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user)
// offering version contained in this snapshot.
Version *CatalogOfferingVersionReference `json:"version" validate:"required"`
}
// UnmarshalSnapshotCatalogOffering unmarshals an instance of SnapshotCatalogOffering from the specified map of raw messages.
func UnmarshalSnapshotCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotCatalogOffering)
err = core.UnmarshalModel(m, "plan", &obj.Plan, UnmarshalCatalogOfferingVersionPlanReference)
if err != nil {
err = core.SDKErrorf(err, "", "plan-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference)
if err != nil {
err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SnapshotClone : SnapshotClone struct
type SnapshotClone struct {
// Indicates whether this snapshot clone is available for use.
Available *bool `json:"available" validate:"required"`
// The date and time that this snapshot clone was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The zone this snapshot clone resides in.
Zone *ZoneReference `json:"zone" validate:"required"`
}
// UnmarshalSnapshotClone unmarshals an instance of SnapshotClone from the specified map of raw messages.
func UnmarshalSnapshotClone(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotClone)
err = core.UnmarshalPrimitive(m, "available", &obj.Available)
if err != nil {
err = core.SDKErrorf(err, "", "available-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SnapshotCloneCollection : SnapshotCloneCollection struct
type SnapshotCloneCollection struct {
// The clones for the snapshot.
Clones []SnapshotClone `json:"clones" validate:"required"`
}
// UnmarshalSnapshotCloneCollection unmarshals an instance of SnapshotCloneCollection from the specified map of raw messages.
func UnmarshalSnapshotCloneCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotCloneCollection)
err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClone)
if err != nil {
err = core.SDKErrorf(err, "", "clones-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SnapshotClonePrototype : SnapshotClonePrototype struct
type SnapshotClonePrototype struct {
// The zone this snapshot clone will reside in. Must be in the same region as the
// snapshot.
Zone ZoneIdentityIntf `json:"zone" validate:"required"`
}
// NewSnapshotClonePrototype : Instantiate SnapshotClonePrototype (Generic Model Constructor)
func (*VpcV1) NewSnapshotClonePrototype(zone ZoneIdentityIntf) (_model *SnapshotClonePrototype, err error) {
_model = &SnapshotClonePrototype{
Zone: zone,
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalSnapshotClonePrototype unmarshals an instance of SnapshotClonePrototype from the specified map of raw messages.
func UnmarshalSnapshotClonePrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotClonePrototype)
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SnapshotCollection : SnapshotCollection struct
type SnapshotCollection struct {
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of snapshots.
Snapshots []Snapshot `json:"snapshots" validate:"required"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalSnapshotCollection unmarshals an instance of SnapshotCollection from the specified map of raw messages.
func UnmarshalSnapshotCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshot)
if err != nil {
err = core.SDKErrorf(err, "", "snapshots-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *SnapshotCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// SnapshotConsistencyGroup : SnapshotConsistencyGroup struct
type SnapshotConsistencyGroup struct {
// If present, the backup policy plan which created this snapshot consistency group.
BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan,omitempty"`
// The date and time that this snapshot consistency group was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The CRN of this snapshot consistency group.
CRN *string `json:"crn" validate:"required"`
// Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group.
DeleteSnapshotsOnDelete *bool `json:"delete_snapshots_on_delete" validate:"required"`
// The URL for this snapshot consistency group.
Href *string `json:"href" validate:"required"`
// The unique identifier for this snapshot consistency group.
ID *string `json:"id" validate:"required"`
// The lifecycle state of this snapshot consistency group.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The name for this snapshot consistency group. The name is unique across all snapshot consistency groups in the
// region.
Name *string `json:"name" validate:"required"`
// The resource group for this snapshot consistency group.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot consistency
// group. Each tag is prefixed with
// [is.instance:](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-faqs).
ServiceTags []string `json:"service_tags" validate:"required"`
// The member snapshots that are data-consistent with respect to captured time. (may be
// [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)).
Snapshots []SnapshotReference `json:"snapshots" validate:"required"`
}
// Constants associated with the SnapshotConsistencyGroup.LifecycleState property.
// The lifecycle state of this snapshot consistency group.
const (
SnapshotConsistencyGroupLifecycleStateDeletingConst = "deleting"
SnapshotConsistencyGroupLifecycleStateFailedConst = "failed"
SnapshotConsistencyGroupLifecycleStatePendingConst = "pending"
SnapshotConsistencyGroupLifecycleStateStableConst = "stable"
SnapshotConsistencyGroupLifecycleStateSuspendedConst = "suspended"
SnapshotConsistencyGroupLifecycleStateUpdatingConst = "updating"
SnapshotConsistencyGroupLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the SnapshotConsistencyGroup.ResourceType property.
// The resource type.
const (
SnapshotConsistencyGroupResourceTypeSnapshotConsistencyGroupConst = "snapshot_consistency_group"
)
// UnmarshalSnapshotConsistencyGroup unmarshals an instance of SnapshotConsistencyGroup from the specified map of raw messages.
func UnmarshalSnapshotConsistencyGroup(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotConsistencyGroup)
err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference)
if err != nil {
err = core.SDKErrorf(err, "", "backup_policy_plan-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete)
if err != nil {
err = core.SDKErrorf(err, "", "delete_snapshots_on_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "service_tags", &obj.ServiceTags)
if err != nil {
err = core.SDKErrorf(err, "", "service_tags-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotReference)
if err != nil {
err = core.SDKErrorf(err, "", "snapshots-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SnapshotConsistencyGroupCollection : SnapshotConsistencyGroupCollection struct
type SnapshotConsistencyGroupCollection struct {
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// A page of snapshot consistency groups.
SnapshotConsistencyGroups []SnapshotConsistencyGroup `json:"snapshot_consistency_groups" validate:"required"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalSnapshotConsistencyGroupCollection unmarshals an instance of SnapshotConsistencyGroupCollection from the specified map of raw messages.
func UnmarshalSnapshotConsistencyGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotConsistencyGroupCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "snapshot_consistency_groups", &obj.SnapshotConsistencyGroups, UnmarshalSnapshotConsistencyGroup)
if err != nil {
err = core.SDKErrorf(err, "", "snapshot_consistency_groups-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *SnapshotConsistencyGroupCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// SnapshotConsistencyGroupPatch : SnapshotConsistencyGroupPatch struct
type SnapshotConsistencyGroupPatch struct {
// Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group.
DeleteSnapshotsOnDelete *bool `json:"delete_snapshots_on_delete,omitempty"`
// The name for this snapshot consistency group. The name must not be used by another snapshot consistency groups in
// the region.
Name *string `json:"name,omitempty"`
}
// UnmarshalSnapshotConsistencyGroupPatch unmarshals an instance of SnapshotConsistencyGroupPatch from the specified map of raw messages.
func UnmarshalSnapshotConsistencyGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotConsistencyGroupPatch)
err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete)
if err != nil {
err = core.SDKErrorf(err, "", "delete_snapshots_on_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the SnapshotConsistencyGroupPatch
func (snapshotConsistencyGroupPatch *SnapshotConsistencyGroupPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(snapshotConsistencyGroupPatch.DeleteSnapshotsOnDelete) {
_patch["delete_snapshots_on_delete"] = snapshotConsistencyGroupPatch.DeleteSnapshotsOnDelete
}
if !core.IsNil(snapshotConsistencyGroupPatch.Name) {
_patch["name"] = snapshotConsistencyGroupPatch.Name
}
return
}
// SnapshotConsistencyGroupPrototype : SnapshotConsistencyGroupPrototype struct
// Models which "extend" this model:
// - SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots
type SnapshotConsistencyGroupPrototype struct {
// Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group.
DeleteSnapshotsOnDelete *bool `json:"delete_snapshots_on_delete,omitempty"`
// The name for this snapshot consistency group. The name must be unique across all snapshot consistency groups in the
// region.
//
// 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The data-consistent member snapshots to create. All snapshots must specify a
// `source_volume` attached to the same virtual server instance.
Snapshots []SnapshotPrototypeSnapshotConsistencyGroupContext `json:"snapshots,omitempty"`
}
func (*SnapshotConsistencyGroupPrototype) isaSnapshotConsistencyGroupPrototype() bool {
return true
}
type SnapshotConsistencyGroupPrototypeIntf interface {
isaSnapshotConsistencyGroupPrototype() bool
}
// UnmarshalSnapshotConsistencyGroupPrototype unmarshals an instance of SnapshotConsistencyGroupPrototype from the specified map of raw messages.
func UnmarshalSnapshotConsistencyGroupPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotConsistencyGroupPrototype)
err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete)
if err != nil {
err = core.SDKErrorf(err, "", "delete_snapshots_on_delete-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext)
if err != nil {
err = core.SDKErrorf(err, "", "snapshots-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SnapshotConsistencyGroupReference : SnapshotConsistencyGroupReference struct
type SnapshotConsistencyGroupReference struct {
// The CRN of this snapshot consistency group.
CRN *string `json:"crn" validate:"required"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this snapshot consistency group.
Href *string `json:"href" validate:"required"`
// The unique identifier for this snapshot consistency group.
ID *string `json:"id" validate:"required"`
// The name for this snapshot consistency group. The name is unique across all snapshot consistency groups in the
// region.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the SnapshotConsistencyGroupReference.ResourceType property.
// The resource type.
const (
SnapshotConsistencyGroupReferenceResourceTypeSnapshotConsistencyGroupConst = "snapshot_consistency_group"
)
// UnmarshalSnapshotConsistencyGroupReference unmarshals an instance of SnapshotConsistencyGroupReference from the specified map of raw messages.
func UnmarshalSnapshotConsistencyGroupReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotConsistencyGroupReference)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SnapshotCopiesItem : SnapshotCopiesItem struct
type SnapshotCopiesItem struct {
// The CRN for the copied snapshot.
CRN *string `json:"crn" validate:"required"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for the copied snapshot.
Href *string `json:"href" validate:"required"`
// The unique identifier for the copied snapshot.
ID *string `json:"id" validate:"required"`
// The name for the copied snapshot.
Name *string `json:"name" validate:"required"`
// If present, this property indicates that the resource associated with this reference
// is remote and therefore may not be directly retrievable.
Remote *SnapshotRemote `json:"remote,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the SnapshotCopiesItem.ResourceType property.
// The resource type.
const (
SnapshotCopiesItemResourceTypeSnapshotConst = "snapshot"
)
// UnmarshalSnapshotCopiesItem unmarshals an instance of SnapshotCopiesItem from the specified map of raw messages.
func UnmarshalSnapshotCopiesItem(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotCopiesItem)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote)
if err != nil {
err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SnapshotIdentity : Identifies a snapshot by a unique property.
// Models which "extend" this model:
// - SnapshotIdentityByID
// - SnapshotIdentityByCRN
// - SnapshotIdentityByHref
type SnapshotIdentity struct {
// The unique identifier for this snapshot.
ID *string `json:"id,omitempty"`
// The CRN of this snapshot.
CRN *string `json:"crn,omitempty"`
// The URL for this snapshot.
Href *string `json:"href,omitempty"`
}
func (*SnapshotIdentity) isaSnapshotIdentity() bool {
return true
}
type SnapshotIdentityIntf interface {
isaSnapshotIdentity() bool
}
// UnmarshalSnapshotIdentity unmarshals an instance of SnapshotIdentity from the specified map of raw messages.
func UnmarshalSnapshotIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotIdentity)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SnapshotInstanceProfileCollection : SnapshotInstanceProfileCollection struct
type SnapshotInstanceProfileCollection struct {
// A link to the first page of resources.
First *PageLink `json:"first" validate:"required"`
// A page of instance profiles compatible with the snapshot.
InstanceProfiles []InstanceProfileReference `json:"instance_profiles" 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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalSnapshotInstanceProfileCollection unmarshals an instance of SnapshotInstanceProfileCollection from the specified map of raw messages.
func UnmarshalSnapshotInstanceProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotInstanceProfileCollection)
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "instance_profiles", &obj.InstanceProfiles, UnmarshalInstanceProfileReference)
if err != nil {
err = core.SDKErrorf(err, "", "instance_profiles-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *SnapshotInstanceProfileCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// SnapshotPatch : SnapshotPatch struct
type SnapshotPatch struct {
// The usage constraints to be matched against the requested instance properties to
// determine compatibility. While bare metal servers cannot be provisioned from snapshots,
// an image or volume created from this snapshot will inherit its `allowed_use` value.
//
// Can only be specified for bootable snapshots.
AllowedUse *SnapshotAllowedUsePatch `json:"allowed_use,omitempty"`
// The name for this snapshot. The name must not be used by another snapshot in the region.
Name *string `json:"name,omitempty"`
// The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot.
UserTags []string `json:"user_tags,omitempty"`
}
// UnmarshalSnapshotPatch unmarshals an instance of SnapshotPatch from the specified map of raw messages.
func UnmarshalSnapshotPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotPatch)
err = core.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalSnapshotAllowedUsePatch)
if err != nil {
err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags)
if err != nil {
err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the SnapshotPatch
func (snapshotPatch *SnapshotPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(snapshotPatch.AllowedUse) {
_patch["allowed_use"] = snapshotPatch.AllowedUse.asPatch()
}
if !core.IsNil(snapshotPatch.Name) {
_patch["name"] = snapshotPatch.Name
}
if !core.IsNil(snapshotPatch.UserTags) {
_patch["user_tags"] = snapshotPatch.UserTags
}
return
}
// SnapshotPrototype : SnapshotPrototype struct
// Models which "extend" this model:
// - SnapshotPrototypeSnapshotBySourceVolume
// - SnapshotPrototypeSnapshotBySourceSnapshot
type SnapshotPrototype struct {
// The usage constraints to match against the requested instance or bare metal server
// properties to determine compatibility.
//
// Can only be specified for bootable snapshots.
AllowedUse *SnapshotAllowedUsePrototype `json:"allowed_use,omitempty"`
// The clones to create for this snapshot.
Clones []SnapshotClonePrototype `json:"clones,omitempty"`
// The name for this snapshot. The name must not be used by another snapshot in the region. 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) will be used.
ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"`
// The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot.
UserTags []string `json:"user_tags,omitempty"`
// The volume to create this snapshot from.
SourceVolume VolumeIdentityIntf `json:"source_volume,omitempty"`
// The root key to use to wrap the data encryption key for this snapshot.
//
// A key must be specified if and only if the source snapshot has an `encryption` type of
// `user_managed`. To maximize snapshot availability and sharing of snapshot data, specify
// a key in the same region as the new snapshot, and use the same encryption key for all
// snapshots using the same source volume.
//
// The specified key may be in a different account, subject to IAM policies.
EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"`
// The source snapshot (in another region) to create this snapshot from.
// The specified snapshot must not already be the source of another snapshot in this
// region.
SourceSnapshot *SnapshotIdentityByCRN `json:"source_snapshot,omitempty"`
}
func (*SnapshotPrototype) isaSnapshotPrototype() bool {
return true
}
type SnapshotPrototypeIntf interface {
isaSnapshotPrototype() bool
}
// UnmarshalSnapshotPrototype unmarshals an instance of SnapshotPrototype from the specified map of raw messages.
func UnmarshalSnapshotPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotPrototype)
err = core.UnmarshalModel(m, "allowed_use", &obj.AllowedUse, UnmarshalSnapshotAllowedUsePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "allowed_use-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype)
if err != nil {
err = core.SDKErrorf(err, "", "clones-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags)
if err != nil {
err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentityByCRN)
if err != nil {
err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SnapshotPrototypeSnapshotConsistencyGroupContext : SnapshotPrototypeSnapshotConsistencyGroupContext struct
type SnapshotPrototypeSnapshotConsistencyGroupContext struct {
// The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name
// will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The volume to create this snapshot from.
SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"`
// The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot.
UserTags []string `json:"user_tags,omitempty"`
}
// NewSnapshotPrototypeSnapshotConsistencyGroupContext : Instantiate SnapshotPrototypeSnapshotConsistencyGroupContext (Generic Model Constructor)
func (*VpcV1) NewSnapshotPrototypeSnapshotConsistencyGroupContext(sourceVolume VolumeIdentityIntf) (_model *SnapshotPrototypeSnapshotConsistencyGroupContext, err error) {
_model = &SnapshotPrototypeSnapshotConsistencyGroupContext{
SourceVolume: sourceVolume,
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext unmarshals an instance of SnapshotPrototypeSnapshotConsistencyGroupContext from the specified map of raw messages.
func UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotPrototypeSnapshotConsistencyGroupContext)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags)
if err != nil {
err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SnapshotReference : SnapshotReference struct
type SnapshotReference struct {
// The CRN of this snapshot.
CRN *string `json:"crn" validate:"required"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for this snapshot.
Href *string `json:"href" validate:"required"`
// The unique identifier for this snapshot.
ID *string `json:"id" validate:"required"`
// The name for this snapshot. The name is unique across all snapshots in the region.
Name *string `json:"name" validate:"required"`
// If present, this property indicates that the resource associated with this reference
// is remote and therefore may not be directly retrievable.
Remote *SnapshotRemote `json:"remote,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the SnapshotReference.ResourceType property.
// The resource type.
const (
SnapshotReferenceResourceTypeSnapshotConst = "snapshot"
)
// UnmarshalSnapshotReference unmarshals an instance of SnapshotReference from the specified map of raw messages.
func UnmarshalSnapshotReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotReference)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote)
if err != nil {
err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SnapshotRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not
// be directly retrievable.
type SnapshotRemote struct {
// If present, this property indicates that the referenced resource is remote to this
// account, and identifies the owning account.
Account *AccountReference `json:"account,omitempty"`
// If present, this property indicates that the referenced resource is remote to this
// region, and identifies the native region.
Region *RegionReference `json:"region,omitempty"`
}
// UnmarshalSnapshotRemote unmarshals an instance of SnapshotRemote from the specified map of raw messages.
func UnmarshalSnapshotRemote(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotRemote)
err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference)
if err != nil {
err = core.SDKErrorf(err, "", "account-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference)
if err != nil {
err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SnapshotSourceSnapshot : If present, the source snapshot this snapshot was created from.
type SnapshotSourceSnapshot struct {
// The CRN of the source snapshot.
CRN *string `json:"crn" validate:"required"`
// If present, this property indicates the referenced resource has been deleted, and provides
// some supplementary information.
Deleted *Deleted `json:"deleted,omitempty"`
// The URL for the source snapshot.
Href *string `json:"href" validate:"required"`
// The unique identifier for the source snapshot.
ID *string `json:"id" validate:"required"`
// The name for the source snapshot. The name is unique across all snapshots in the source snapshot's native region.
Name *string `json:"name" validate:"required"`
// If present, this property indicates that the resource associated with this reference
// is remote and therefore may not be directly retrievable.
Remote *SnapshotRemote `json:"remote,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the SnapshotSourceSnapshot.ResourceType property.
// The resource type.
const (
SnapshotSourceSnapshotResourceTypeSnapshotConst = "snapshot"
)
// UnmarshalSnapshotSourceSnapshot unmarshals an instance of SnapshotSourceSnapshot from the specified map of raw messages.
func UnmarshalSnapshotSourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SnapshotSourceSnapshot)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote)
if err != nil {
err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// StartBareMetalServerOptions : The StartBareMetalServer options.
type StartBareMetalServerOptions struct {
// The bare metal server identifier.
ID *string `json:"id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewStartBareMetalServerOptions : Instantiate StartBareMetalServerOptions
func (*VpcV1) NewStartBareMetalServerOptions(id string) *StartBareMetalServerOptions {
return &StartBareMetalServerOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *StartBareMetalServerOptions) SetID(id string) *StartBareMetalServerOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *StartBareMetalServerOptions) SetHeaders(param map[string]string) *StartBareMetalServerOptions {
options.Headers = param
return options
}
// StopBareMetalServerOptions : The StopBareMetalServer options.
type StopBareMetalServerOptions struct {
// The bare metal server identifier.
ID *string `json:"id" validate:"required,ne="`
// The type of stop operation:
// - `soft`: signal running operating system to quiesce and shutdown cleanly
// - `hard`: immediately stop the server.
Type *string `json:"type" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// Constants associated with the StopBareMetalServerOptions.Type property.
// The type of stop operation:
// - `soft`: signal running operating system to quiesce and shutdown cleanly
// - `hard`: immediately stop the server.
const (
StopBareMetalServerOptionsTypeHardConst = "hard"
StopBareMetalServerOptionsTypeSoftConst = "soft"
)
// NewStopBareMetalServerOptions : Instantiate StopBareMetalServerOptions
func (*VpcV1) NewStopBareMetalServerOptions(id string, typeVar string) *StopBareMetalServerOptions {
return &StopBareMetalServerOptions{
ID: core.StringPtr(id),
Type: core.StringPtr(typeVar),
}
}
// SetID : Allow user to set ID
func (_options *StopBareMetalServerOptions) SetID(id string) *StopBareMetalServerOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetType : Allow user to set Type
func (_options *StopBareMetalServerOptions) SetType(typeVar string) *StopBareMetalServerOptions {
_options.Type = core.StringPtr(typeVar)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *StopBareMetalServerOptions) SetHeaders(param map[string]string) *StopBareMetalServerOptions {
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 name for this subnet. The name is unique across all subnets in the VPC.
Name *string `json:"name" validate:"required"`
// The network ACL for this subnet.
NetworkACL *NetworkACLReference `json:"network_acl" validate:"required"`
// The public gateway to use for 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 resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The routing table for this subnet.
RoutingTable *RoutingTableReference `json:"routing_table" validate:"required"`
// The status of the subnet.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 resides in.
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.ResourceType property.
// The resource type.
const (
SubnetResourceTypeSubnetConst = "subnet"
)
// Constants associated with the Subnet.Status property.
// The status of the subnet.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 {
err = core.SDKErrorf(err, "", "available_ipv4_address_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion)
if err != nil {
err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock)
if err != nil {
err = core.SDKErrorf(err, "", "ipv4_cidr_block-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLReference)
if err != nil {
err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayReference)
if err != nil {
err = core.SDKErrorf(err, "", "public_gateway-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableReference)
if err != nil {
err = core.SDKErrorf(err, "", "routing_table-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_ipv4_address_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
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 *PageLink `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 *PageLink `json:"next,omitempty"`
// A page 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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnet)
if err != nil {
err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *SubnetCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// 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
asPatch() map[string]interface{}
}
// 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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the SubnetIdentity
func (subnetIdentity *SubnetIdentity) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(subnetIdentity.ID) {
_patch["id"] = subnetIdentity.ID
}
if !core.IsNil(subnetIdentity.CRN) {
_patch["crn"] = subnetIdentity.CRN
}
if !core.IsNil(subnetIdentity.Href) {
_patch["href"] = subnetIdentity.Href
}
return
}
// SubnetPatch : SubnetPatch struct
type SubnetPatch struct {
// The name for this subnet. The name must not be used by another subnet in the VPC.
Name *string `json:"name,omitempty"`
// The network ACL to use for this subnet.
NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"`
// The public gateway to use for internet-bound traffic for this subnet.
PublicGateway SubnetPublicGatewayPatchIntf `json:"public_gateway,omitempty"`
// The routing table to use for this subnet. The routing table properties
// `route_direct_link_ingress`, `route_internet_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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalSubnetPublicGatewayPatch)
if err != nil {
err = core.SDKErrorf(err, "", "public_gateway-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "routing_table-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(subnetPatch.Name) {
_patch["name"] = subnetPatch.Name
}
if !core.IsNil(subnetPatch.NetworkACL) {
_patch["network_acl"] = subnetPatch.NetworkACL.asPatch()
}
if !core.IsNil(subnetPatch.PublicGateway) {
_patch["public_gateway"] = subnetPatch.PublicGateway.asPatch()
}
if !core.IsNil(subnetPatch.RoutingTable) {
_patch["routing_table"] = subnetPatch.RoutingTable.asPatch()
}
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 name for this subnet. The name must not be used by another subnet in the VPC. 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 use for internet-bound traffic for this subnet. If
// unspecified, the subnet will not be attached to a public gateway.
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) will be 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_internet_ingress`, `route_transit_gateway_ingress`, and
// `route_vpc_zone_ingress` must be `false`.
RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"`
// The VPC the subnet will reside in.
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 and must not overlap with any existing subnet. 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 {
err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "public_gateway-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "routing_table-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_ipv4_address_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock)
if err != nil {
err = core.SDKErrorf(err, "", "ipv4_cidr_block-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// SubnetPublicGatewayPatch : The public gateway to use for internet-bound traffic for this subnet.
// Models which "extend" this model:
// - SubnetPublicGatewayPatchPublicGatewayIdentityByID
// - SubnetPublicGatewayPatchPublicGatewayIdentityByCRN
// - SubnetPublicGatewayPatchPublicGatewayIdentityByHref
type SubnetPublicGatewayPatch 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 (*SubnetPublicGatewayPatch) isaSubnetPublicGatewayPatch() bool {
return true
}
type SubnetPublicGatewayPatchIntf interface {
isaSubnetPublicGatewayPatch() bool
asPatch() map[string]interface{}
}
// UnmarshalSubnetPublicGatewayPatch unmarshals an instance of SubnetPublicGatewayPatch from the specified map of raw messages.
func UnmarshalSubnetPublicGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SubnetPublicGatewayPatch)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the SubnetPublicGatewayPatch
func (subnetPublicGatewayPatch *SubnetPublicGatewayPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(subnetPublicGatewayPatch.ID) {
_patch["id"] = subnetPublicGatewayPatch.ID
}
if !core.IsNil(subnetPublicGatewayPatch.CRN) {
_patch["crn"] = subnetPublicGatewayPatch.CRN
}
if !core.IsNil(subnetPublicGatewayPatch.Href) {
_patch["href"] = subnetPublicGatewayPatch.Href
}
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 *Deleted `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 name for this subnet. The name is unique across all subnets in the VPC.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the SubnetReference.ResourceType property.
// The resource type.
const (
SubnetReferenceResourceTypeSubnetConst = "subnet"
)
// 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 {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// TrustedProfileIdentity : Identifies a trusted profile by a unique property.
// Models which "extend" this model:
// - TrustedProfileIdentityByID
// - TrustedProfileIdentityByCRN
type TrustedProfileIdentity struct {
// The unique identifier for this trusted profile.
ID *string `json:"id,omitempty"`
// The CRN for this trusted profile.
CRN *string `json:"crn,omitempty"`
}
func (*TrustedProfileIdentity) isaTrustedProfileIdentity() bool {
return true
}
type TrustedProfileIdentityIntf interface {
isaTrustedProfileIdentity() bool
}
// UnmarshalTrustedProfileIdentity unmarshals an instance of TrustedProfileIdentity from the specified map of raw messages.
func UnmarshalTrustedProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(TrustedProfileIdentity)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// TrustedProfileReference : TrustedProfileReference struct
type TrustedProfileReference struct {
// The CRN for this trusted profile.
CRN *string `json:"crn" validate:"required"`
// The unique identifier for this trusted profile.
ID *string `json:"id" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the TrustedProfileReference.ResourceType property.
// The resource type.
const (
TrustedProfileReferenceResourceTypeTrustedProfileConst = "trusted_profile"
)
// UnmarshalTrustedProfileReference unmarshals an instance of TrustedProfileReference from the specified map of raw messages.
func UnmarshalTrustedProfileReference(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(TrustedProfileReference)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// UnpublishPrivatePathServiceGatewayOptions : The UnpublishPrivatePathServiceGateway options.
type UnpublishPrivatePathServiceGatewayOptions struct {
// The private path service gateway identifier.
PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUnpublishPrivatePathServiceGatewayOptions : Instantiate UnpublishPrivatePathServiceGatewayOptions
func (*VpcV1) NewUnpublishPrivatePathServiceGatewayOptions(privatePathServiceGatewayID string) *UnpublishPrivatePathServiceGatewayOptions {
return &UnpublishPrivatePathServiceGatewayOptions{
PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID),
}
}
// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID
func (_options *UnpublishPrivatePathServiceGatewayOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *UnpublishPrivatePathServiceGatewayOptions {
_options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UnpublishPrivatePathServiceGatewayOptions) SetHeaders(param map[string]string) *UnpublishPrivatePathServiceGatewayOptions {
options.Headers = param
return options
}
// UnsetSubnetPublicGatewayOptions : The UnsetSubnetPublicGateway options.
type UnsetSubnetPublicGatewayOptions struct {
// The subnet identifier.
ID *string `json:"id" 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
}
// UpdateBackupPolicyOptions : The UpdateBackupPolicy options.
type UpdateBackupPolicyOptions struct {
// The backup policy identifier.
ID *string `json:"id" validate:"required,ne="`
// The backup policy patch.
BackupPolicyPatch map[string]interface{} `json:"BackupPolicy_patch" validate:"required"`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
// Required if the request body includes an array.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateBackupPolicyOptions : Instantiate UpdateBackupPolicyOptions
func (*VpcV1) NewUpdateBackupPolicyOptions(id string, backupPolicyPatch map[string]interface{}) *UpdateBackupPolicyOptions {
return &UpdateBackupPolicyOptions{
ID: core.StringPtr(id),
BackupPolicyPatch: backupPolicyPatch,
}
}
// SetID : Allow user to set ID
func (_options *UpdateBackupPolicyOptions) SetID(id string) *UpdateBackupPolicyOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetBackupPolicyPatch : Allow user to set BackupPolicyPatch
func (_options *UpdateBackupPolicyOptions) SetBackupPolicyPatch(backupPolicyPatch map[string]interface{}) *UpdateBackupPolicyOptions {
_options.BackupPolicyPatch = backupPolicyPatch
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *UpdateBackupPolicyOptions) SetIfMatch(ifMatch string) *UpdateBackupPolicyOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateBackupPolicyOptions) SetHeaders(param map[string]string) *UpdateBackupPolicyOptions {
options.Headers = param
return options
}
// UpdateBackupPolicyPlanOptions : The UpdateBackupPolicyPlan options.
type UpdateBackupPolicyPlanOptions struct {
// The backup policy identifier.
BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="`
// The backup policy plan identifier.
ID *string `json:"id" validate:"required,ne="`
// The backup policy plan patch.
BackupPolicyPlanPatch map[string]interface{} `json:"BackupPolicyPlan_patch" validate:"required"`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
// Required if the request body includes an array.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateBackupPolicyPlanOptions : Instantiate UpdateBackupPolicyPlanOptions
func (*VpcV1) NewUpdateBackupPolicyPlanOptions(backupPolicyID string, id string, backupPolicyPlanPatch map[string]interface{}) *UpdateBackupPolicyPlanOptions {
return &UpdateBackupPolicyPlanOptions{
BackupPolicyID: core.StringPtr(backupPolicyID),
ID: core.StringPtr(id),
BackupPolicyPlanPatch: backupPolicyPlanPatch,
}
}
// SetBackupPolicyID : Allow user to set BackupPolicyID
func (_options *UpdateBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *UpdateBackupPolicyPlanOptions {
_options.BackupPolicyID = core.StringPtr(backupPolicyID)
return _options
}
// SetID : Allow user to set ID
func (_options *UpdateBackupPolicyPlanOptions) SetID(id string) *UpdateBackupPolicyPlanOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetBackupPolicyPlanPatch : Allow user to set BackupPolicyPlanPatch
func (_options *UpdateBackupPolicyPlanOptions) SetBackupPolicyPlanPatch(backupPolicyPlanPatch map[string]interface{}) *UpdateBackupPolicyPlanOptions {
_options.BackupPolicyPlanPatch = backupPolicyPlanPatch
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *UpdateBackupPolicyPlanOptions) SetIfMatch(ifMatch string) *UpdateBackupPolicyPlanOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateBackupPolicyPlanOptions) SetHeaders(param map[string]string) *UpdateBackupPolicyPlanOptions {
options.Headers = param
return options
}
// UpdateBareMetalServerDiskOptions : The UpdateBareMetalServerDisk options.
type UpdateBareMetalServerDiskOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// The bare metal server disk identifier.
ID *string `json:"id" validate:"required,ne="`
// The bare metal server disk patch.
BareMetalServerDiskPatch map[string]interface{} `json:"BareMetalServerDisk_patch" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateBareMetalServerDiskOptions : Instantiate UpdateBareMetalServerDiskOptions
func (*VpcV1) NewUpdateBareMetalServerDiskOptions(bareMetalServerID string, id string, bareMetalServerDiskPatch map[string]interface{}) *UpdateBareMetalServerDiskOptions {
return &UpdateBareMetalServerDiskOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
ID: core.StringPtr(id),
BareMetalServerDiskPatch: bareMetalServerDiskPatch,
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *UpdateBareMetalServerDiskOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerDiskOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetID : Allow user to set ID
func (_options *UpdateBareMetalServerDiskOptions) SetID(id string) *UpdateBareMetalServerDiskOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetBareMetalServerDiskPatch : Allow user to set BareMetalServerDiskPatch
func (_options *UpdateBareMetalServerDiskOptions) SetBareMetalServerDiskPatch(bareMetalServerDiskPatch map[string]interface{}) *UpdateBareMetalServerDiskOptions {
_options.BareMetalServerDiskPatch = bareMetalServerDiskPatch
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateBareMetalServerDiskOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerDiskOptions {
options.Headers = param
return options
}
// UpdateBareMetalServerNetworkAttachmentOptions : The UpdateBareMetalServerNetworkAttachment options.
type UpdateBareMetalServerNetworkAttachmentOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// The bare metal server network attachment identifier.
ID *string `json:"id" validate:"required,ne="`
// The bare metal server network attachment patch.
BareMetalServerNetworkAttachmentPatch map[string]interface{} `json:"BareMetalServerNetworkAttachment_patch" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateBareMetalServerNetworkAttachmentOptions : Instantiate UpdateBareMetalServerNetworkAttachmentOptions
func (*VpcV1) NewUpdateBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string, bareMetalServerNetworkAttachmentPatch map[string]interface{}) *UpdateBareMetalServerNetworkAttachmentOptions {
return &UpdateBareMetalServerNetworkAttachmentOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
ID: core.StringPtr(id),
BareMetalServerNetworkAttachmentPatch: bareMetalServerNetworkAttachmentPatch,
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerNetworkAttachmentOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetID : Allow user to set ID
func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetID(id string) *UpdateBareMetalServerNetworkAttachmentOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetBareMetalServerNetworkAttachmentPatch : Allow user to set BareMetalServerNetworkAttachmentPatch
func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerNetworkAttachmentPatch(bareMetalServerNetworkAttachmentPatch map[string]interface{}) *UpdateBareMetalServerNetworkAttachmentOptions {
_options.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatch
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerNetworkAttachmentOptions {
options.Headers = param
return options
}
// UpdateBareMetalServerNetworkInterfaceOptions : The UpdateBareMetalServerNetworkInterface options.
type UpdateBareMetalServerNetworkInterfaceOptions struct {
// The bare metal server identifier.
BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="`
// The bare metal server network interface identifier.
ID *string `json:"id" validate:"required,ne="`
// The bare metal server network interface patch.
BareMetalServerNetworkInterfacePatch map[string]interface{} `json:"BareMetalServerNetworkInterface_patch" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateBareMetalServerNetworkInterfaceOptions : Instantiate UpdateBareMetalServerNetworkInterfaceOptions
func (*VpcV1) NewUpdateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string, bareMetalServerNetworkInterfacePatch map[string]interface{}) *UpdateBareMetalServerNetworkInterfaceOptions {
return &UpdateBareMetalServerNetworkInterfaceOptions{
BareMetalServerID: core.StringPtr(bareMetalServerID),
ID: core.StringPtr(id),
BareMetalServerNetworkInterfacePatch: bareMetalServerNetworkInterfacePatch,
}
}
// SetBareMetalServerID : Allow user to set BareMetalServerID
func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerNetworkInterfaceOptions {
_options.BareMetalServerID = core.StringPtr(bareMetalServerID)
return _options
}
// SetID : Allow user to set ID
func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetID(id string) *UpdateBareMetalServerNetworkInterfaceOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetBareMetalServerNetworkInterfacePatch : Allow user to set BareMetalServerNetworkInterfacePatch
func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePatch(bareMetalServerNetworkInterfacePatch map[string]interface{}) *UpdateBareMetalServerNetworkInterfaceOptions {
_options.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatch
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerNetworkInterfaceOptions {
options.Headers = param
return options
}
// UpdateBareMetalServerOptions : The UpdateBareMetalServer options.
type UpdateBareMetalServerOptions struct {
// The bare metal server identifier.
ID *string `json:"id" validate:"required,ne="`
// The bare metal server patch.
BareMetalServerPatch map[string]interface{} `json:"BareMetalServer_patch" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateBareMetalServerOptions : Instantiate UpdateBareMetalServerOptions
func (*VpcV1) NewUpdateBareMetalServerOptions(id string, bareMetalServerPatch map[string]interface{}) *UpdateBareMetalServerOptions {
return &UpdateBareMetalServerOptions{
ID: core.StringPtr(id),
BareMetalServerPatch: bareMetalServerPatch,
}
}
// SetID : Allow user to set ID
func (_options *UpdateBareMetalServerOptions) SetID(id string) *UpdateBareMetalServerOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetBareMetalServerPatch : Allow user to set BareMetalServerPatch
func (_options *UpdateBareMetalServerOptions) SetBareMetalServerPatch(bareMetalServerPatch map[string]interface{}) *UpdateBareMetalServerOptions {
_options.BareMetalServerPatch = bareMetalServerPatch
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateBareMetalServerOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerOptions {
options.Headers = param
return options
}
// UpdateClusterNetworkInterfaceOptions : The UpdateClusterNetworkInterface options.
type UpdateClusterNetworkInterfaceOptions struct {
// The cluster network identifier.
ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="`
// The cluster network interface identifier.
ID *string `json:"id" validate:"required,ne="`
// The cluster network interface patch.
ClusterNetworkInterfacePatch map[string]interface{} `json:"ClusterNetworkInterface_patch" validate:"required"`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
// Required if the request body includes an array.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateClusterNetworkInterfaceOptions : Instantiate UpdateClusterNetworkInterfaceOptions
func (*VpcV1) NewUpdateClusterNetworkInterfaceOptions(clusterNetworkID string, id string, clusterNetworkInterfacePatch map[string]interface{}) *UpdateClusterNetworkInterfaceOptions {
return &UpdateClusterNetworkInterfaceOptions{
ClusterNetworkID: core.StringPtr(clusterNetworkID),
ID: core.StringPtr(id),
ClusterNetworkInterfacePatch: clusterNetworkInterfacePatch,
}
}
// SetClusterNetworkID : Allow user to set ClusterNetworkID
func (_options *UpdateClusterNetworkInterfaceOptions) SetClusterNetworkID(clusterNetworkID string) *UpdateClusterNetworkInterfaceOptions {
_options.ClusterNetworkID = core.StringPtr(clusterNetworkID)
return _options
}
// SetID : Allow user to set ID
func (_options *UpdateClusterNetworkInterfaceOptions) SetID(id string) *UpdateClusterNetworkInterfaceOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetClusterNetworkInterfacePatch : Allow user to set ClusterNetworkInterfacePatch
func (_options *UpdateClusterNetworkInterfaceOptions) SetClusterNetworkInterfacePatch(clusterNetworkInterfacePatch map[string]interface{}) *UpdateClusterNetworkInterfaceOptions {
_options.ClusterNetworkInterfacePatch = clusterNetworkInterfacePatch
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *UpdateClusterNetworkInterfaceOptions) SetIfMatch(ifMatch string) *UpdateClusterNetworkInterfaceOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateClusterNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateClusterNetworkInterfaceOptions {
options.Headers = param
return options
}
// UpdateClusterNetworkOptions : The UpdateClusterNetwork options.
type UpdateClusterNetworkOptions struct {
// The cluster network identifier.
ID *string `json:"id" validate:"required,ne="`
// The cluster network patch.
ClusterNetworkPatch map[string]interface{} `json:"ClusterNetwork_patch" validate:"required"`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
// Required if the request body includes an array.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateClusterNetworkOptions : Instantiate UpdateClusterNetworkOptions
func (*VpcV1) NewUpdateClusterNetworkOptions(id string, clusterNetworkPatch map[string]interface{}) *UpdateClusterNetworkOptions {
return &UpdateClusterNetworkOptions{
ID: core.StringPtr(id),
ClusterNetworkPatch: clusterNetworkPatch,
}
}
// SetID : Allow user to set ID
func (_options *UpdateClusterNetworkOptions) SetID(id string) *UpdateClusterNetworkOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetClusterNetworkPatch : Allow user to set ClusterNetworkPatch
func (_options *UpdateClusterNetworkOptions) SetClusterNetworkPatch(clusterNetworkPatch map[string]interface{}) *UpdateClusterNetworkOptions {
_options.ClusterNetworkPatch = clusterNetworkPatch
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *UpdateClusterNetworkOptions) SetIfMatch(ifMatch string) *UpdateClusterNetworkOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateClusterNetworkOptions) SetHeaders(param map[string]string) *UpdateClusterNetworkOptions {
options.Headers = param
return options
}
// UpdateClusterNetworkSubnetOptions : The UpdateClusterNetworkSubnet options.
type UpdateClusterNetworkSubnetOptions struct {
// The cluster network identifier.
ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="`
// The cluster network subnet identifier.
ID *string `json:"id" validate:"required,ne="`
// The cluster network subnet patch.
ClusterNetworkSubnetPatch map[string]interface{} `json:"ClusterNetworkSubnet_patch" validate:"required"`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
// Required if the request body includes an array.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateClusterNetworkSubnetOptions : Instantiate UpdateClusterNetworkSubnetOptions
func (*VpcV1) NewUpdateClusterNetworkSubnetOptions(clusterNetworkID string, id string, clusterNetworkSubnetPatch map[string]interface{}) *UpdateClusterNetworkSubnetOptions {
return &UpdateClusterNetworkSubnetOptions{
ClusterNetworkID: core.StringPtr(clusterNetworkID),
ID: core.StringPtr(id),
ClusterNetworkSubnetPatch: clusterNetworkSubnetPatch,
}
}
// SetClusterNetworkID : Allow user to set ClusterNetworkID
func (_options *UpdateClusterNetworkSubnetOptions) SetClusterNetworkID(clusterNetworkID string) *UpdateClusterNetworkSubnetOptions {
_options.ClusterNetworkID = core.StringPtr(clusterNetworkID)
return _options
}
// SetID : Allow user to set ID
func (_options *UpdateClusterNetworkSubnetOptions) SetID(id string) *UpdateClusterNetworkSubnetOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetClusterNetworkSubnetPatch : Allow user to set ClusterNetworkSubnetPatch
func (_options *UpdateClusterNetworkSubnetOptions) SetClusterNetworkSubnetPatch(clusterNetworkSubnetPatch map[string]interface{}) *UpdateClusterNetworkSubnetOptions {
_options.ClusterNetworkSubnetPatch = clusterNetworkSubnetPatch
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *UpdateClusterNetworkSubnetOptions) SetIfMatch(ifMatch string) *UpdateClusterNetworkSubnetOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateClusterNetworkSubnetOptions) SetHeaders(param map[string]string) *UpdateClusterNetworkSubnetOptions {
options.Headers = param
return options
}
// UpdateClusterNetworkSubnetReservedIPOptions : The UpdateClusterNetworkSubnetReservedIP options.
type UpdateClusterNetworkSubnetReservedIPOptions struct {
// The cluster network identifier.
ClusterNetworkID *string `json:"cluster_network_id" validate:"required,ne="`
// The cluster network subnet identifier.
ClusterNetworkSubnetID *string `json:"cluster_network_subnet_id" validate:"required,ne="`
// The cluster network subnet reserved IP identifier.
ID *string `json:"id" validate:"required,ne="`
// The cluster network subnet reserved IP patch.
ClusterNetworkSubnetReservedIPPatch map[string]interface{} `json:"ClusterNetworkSubnetReservedIP_patch" validate:"required"`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
// Required if the request body includes an array.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateClusterNetworkSubnetReservedIPOptions : Instantiate UpdateClusterNetworkSubnetReservedIPOptions
func (*VpcV1) NewUpdateClusterNetworkSubnetReservedIPOptions(clusterNetworkID string, clusterNetworkSubnetID string, id string, clusterNetworkSubnetReservedIPPatch map[string]interface{}) *UpdateClusterNetworkSubnetReservedIPOptions {
return &UpdateClusterNetworkSubnetReservedIPOptions{
ClusterNetworkID: core.StringPtr(clusterNetworkID),
ClusterNetworkSubnetID: core.StringPtr(clusterNetworkSubnetID),
ID: core.StringPtr(id),
ClusterNetworkSubnetReservedIPPatch: clusterNetworkSubnetReservedIPPatch,
}
}
// SetClusterNetworkID : Allow user to set ClusterNetworkID
func (_options *UpdateClusterNetworkSubnetReservedIPOptions) SetClusterNetworkID(clusterNetworkID string) *UpdateClusterNetworkSubnetReservedIPOptions {
_options.ClusterNetworkID = core.StringPtr(clusterNetworkID)
return _options
}
// SetClusterNetworkSubnetID : Allow user to set ClusterNetworkSubnetID
func (_options *UpdateClusterNetworkSubnetReservedIPOptions) SetClusterNetworkSubnetID(clusterNetworkSubnetID string) *UpdateClusterNetworkSubnetReservedIPOptions {
_options.ClusterNetworkSubnetID = core.StringPtr(clusterNetworkSubnetID)
return _options
}
// SetID : Allow user to set ID
func (_options *UpdateClusterNetworkSubnetReservedIPOptions) SetID(id string) *UpdateClusterNetworkSubnetReservedIPOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetClusterNetworkSubnetReservedIPPatch : Allow user to set ClusterNetworkSubnetReservedIPPatch
func (_options *UpdateClusterNetworkSubnetReservedIPOptions) SetClusterNetworkSubnetReservedIPPatch(clusterNetworkSubnetReservedIPPatch map[string]interface{}) *UpdateClusterNetworkSubnetReservedIPOptions {
_options.ClusterNetworkSubnetReservedIPPatch = clusterNetworkSubnetReservedIPPatch
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *UpdateClusterNetworkSubnetReservedIPOptions) SetIfMatch(ifMatch string) *UpdateClusterNetworkSubnetReservedIPOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateClusterNetworkSubnetReservedIPOptions) SetHeaders(param map[string]string) *UpdateClusterNetworkSubnetReservedIPOptions {
options.Headers = param
return options
}
// UpdateDedicatedHostDiskOptions : The UpdateDedicatedHostDisk options.
type UpdateDedicatedHostDiskOptions struct {
// The dedicated host identifier.
DedicatedHostID *string `json:"dedicated_host_id" validate:"required,ne="`
// The dedicated host disk identifier.
ID *string `json:"id" validate:"required,ne="`
// The dedicated host disk patch.
DedicatedHostDiskPatch map[string]interface{} `json:"DedicatedHostDisk_patch" 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 `json:"id" validate:"required,ne="`
// The dedicated host group patch.
DedicatedHostGroupPatch map[string]interface{} `json:"DedicatedHostGroup_patch" 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 `json:"id" validate:"required,ne="`
// The dedicated host patch.
DedicatedHostPatch map[string]interface{} `json:"DedicatedHost_patch" 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 `json:"id" validate:"required,ne="`
// The endpoint gateway patch.
EndpointGatewayPatch map[string]interface{} `json:"EndpointGateway_patch" 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
}
// UpdateFirmwareForBareMetalServerOptions : The UpdateFirmwareForBareMetalServer options.
type UpdateFirmwareForBareMetalServerOptions struct {
// The bare metal server identifier.
ID *string `json:"id" validate:"required,ne="`
// Indicates whether to automatically start the bare metal server after the firmware update is successfully completed.
AutoStart *bool `json:"auto_start,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateFirmwareForBareMetalServerOptions : Instantiate UpdateFirmwareForBareMetalServerOptions
func (*VpcV1) NewUpdateFirmwareForBareMetalServerOptions(id string) *UpdateFirmwareForBareMetalServerOptions {
return &UpdateFirmwareForBareMetalServerOptions{
ID: core.StringPtr(id),
}
}
// SetID : Allow user to set ID
func (_options *UpdateFirmwareForBareMetalServerOptions) SetID(id string) *UpdateFirmwareForBareMetalServerOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetAutoStart : Allow user to set AutoStart
func (_options *UpdateFirmwareForBareMetalServerOptions) SetAutoStart(autoStart bool) *UpdateFirmwareForBareMetalServerOptions {
_options.AutoStart = core.BoolPtr(autoStart)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateFirmwareForBareMetalServerOptions) SetHeaders(param map[string]string) *UpdateFirmwareForBareMetalServerOptions {
options.Headers = param
return options
}
// UpdateFloatingIPOptions : The UpdateFloatingIP options.
type UpdateFloatingIPOptions struct {
// The floating IP identifier.
ID *string `json:"id" validate:"required,ne="`
// The floating IP patch.
FloatingIPPatch map[string]interface{} `json:"FloatingIP_patch" 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 `json:"id" validate:"required,ne="`
// The flow log collector patch.
FlowLogCollectorPatch map[string]interface{} `json:"FlowLogCollector_patch" 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 `json:"id" validate:"required,ne="`
// The IKE policy patch.
IkePolicyPatch map[string]interface{} `json:"IkePolicy_patch" 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
}
// UpdateImageExportJobOptions : The UpdateImageExportJob options.
type UpdateImageExportJobOptions struct {
// The image identifier.
ImageID *string `json:"image_id" validate:"required,ne="`
// The image export job identifier.
ID *string `json:"id" validate:"required,ne="`
// The image export job patch.
ImageExportJobPatch map[string]interface{} `json:"ImageExportJob_patch" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateImageExportJobOptions : Instantiate UpdateImageExportJobOptions
func (*VpcV1) NewUpdateImageExportJobOptions(imageID string, id string, imageExportJobPatch map[string]interface{}) *UpdateImageExportJobOptions {
return &UpdateImageExportJobOptions{
ImageID: core.StringPtr(imageID),
ID: core.StringPtr(id),
ImageExportJobPatch: imageExportJobPatch,
}
}
// SetImageID : Allow user to set ImageID
func (_options *UpdateImageExportJobOptions) SetImageID(imageID string) *UpdateImageExportJobOptions {
_options.ImageID = core.StringPtr(imageID)
return _options
}
// SetID : Allow user to set ID
func (_options *UpdateImageExportJobOptions) SetID(id string) *UpdateImageExportJobOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetImageExportJobPatch : Allow user to set ImageExportJobPatch
func (_options *UpdateImageExportJobOptions) SetImageExportJobPatch(imageExportJobPatch map[string]interface{}) *UpdateImageExportJobOptions {
_options.ImageExportJobPatch = imageExportJobPatch
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateImageExportJobOptions) SetHeaders(param map[string]string) *UpdateImageExportJobOptions {
options.Headers = param
return options
}
// UpdateImageOptions : The UpdateImage options.
type UpdateImageOptions struct {
// The image identifier.
ID *string `json:"id" validate:"required,ne="`
// The image patch.
ImagePatch map[string]interface{} `json:"Image_patch" 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
}
// UpdateInstanceClusterNetworkAttachmentOptions : The UpdateInstanceClusterNetworkAttachment options.
type UpdateInstanceClusterNetworkAttachmentOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance cluster network attachment identifier.
ID *string `json:"id" validate:"required,ne="`
// The instance cluster network attachment patch.
InstanceClusterNetworkAttachmentPatch map[string]interface{} `json:"InstanceClusterNetworkAttachment_patch" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateInstanceClusterNetworkAttachmentOptions : Instantiate UpdateInstanceClusterNetworkAttachmentOptions
func (*VpcV1) NewUpdateInstanceClusterNetworkAttachmentOptions(instanceID string, id string, instanceClusterNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceClusterNetworkAttachmentOptions {
return &UpdateInstanceClusterNetworkAttachmentOptions{
InstanceID: core.StringPtr(instanceID),
ID: core.StringPtr(id),
InstanceClusterNetworkAttachmentPatch: instanceClusterNetworkAttachmentPatch,
}
}
// SetInstanceID : Allow user to set InstanceID
func (_options *UpdateInstanceClusterNetworkAttachmentOptions) SetInstanceID(instanceID string) *UpdateInstanceClusterNetworkAttachmentOptions {
_options.InstanceID = core.StringPtr(instanceID)
return _options
}
// SetID : Allow user to set ID
func (_options *UpdateInstanceClusterNetworkAttachmentOptions) SetID(id string) *UpdateInstanceClusterNetworkAttachmentOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetInstanceClusterNetworkAttachmentPatch : Allow user to set InstanceClusterNetworkAttachmentPatch
func (_options *UpdateInstanceClusterNetworkAttachmentOptions) SetInstanceClusterNetworkAttachmentPatch(instanceClusterNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceClusterNetworkAttachmentOptions {
_options.InstanceClusterNetworkAttachmentPatch = instanceClusterNetworkAttachmentPatch
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateInstanceClusterNetworkAttachmentOptions) SetHeaders(param map[string]string) *UpdateInstanceClusterNetworkAttachmentOptions {
options.Headers = param
return options
}
// UpdateInstanceDiskOptions : The UpdateInstanceDisk options.
type UpdateInstanceDiskOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance disk identifier.
ID *string `json:"id" validate:"required,ne="`
// The instance disk patch.
InstanceDiskPatch map[string]interface{} `json:"InstanceDisk_patch" 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
}
// UpdateInstanceGroupManagerActionOptions : The UpdateInstanceGroupManagerAction options.
type UpdateInstanceGroupManagerActionOptions struct {
// The instance group identifier.
InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="`
// The instance group manager identifier.
InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="`
// The instance group manager action identifier.
ID *string `json:"id" validate:"required,ne="`
// The instance group manager action patch.
InstanceGroupManagerActionPatch map[string]interface{} `json:"InstanceGroupManagerAction_patch" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateInstanceGroupManagerActionOptions : Instantiate UpdateInstanceGroupManagerActionOptions
func (*VpcV1) NewUpdateInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string, instanceGroupManagerActionPatch map[string]interface{}) *UpdateInstanceGroupManagerActionOptions {
return &UpdateInstanceGroupManagerActionOptions{
InstanceGroupID: core.StringPtr(instanceGroupID),
InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID),
ID: core.StringPtr(id),
InstanceGroupManagerActionPatch: instanceGroupManagerActionPatch,
}
}
// SetInstanceGroupID : Allow user to set InstanceGroupID
func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerActionOptions {
_options.InstanceGroupID = core.StringPtr(instanceGroupID)
return _options
}
// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID
func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *UpdateInstanceGroupManagerActionOptions {
_options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID)
return _options
}
// SetID : Allow user to set ID
func (_options *UpdateInstanceGroupManagerActionOptions) SetID(id string) *UpdateInstanceGroupManagerActionOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetInstanceGroupManagerActionPatch : Allow user to set InstanceGroupManagerActionPatch
func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupManagerActionPatch(instanceGroupManagerActionPatch map[string]interface{}) *UpdateInstanceGroupManagerActionOptions {
_options.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatch
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerActionOptions {
options.Headers = param
return options
}
// UpdateInstanceGroupManagerOptions : The UpdateInstanceGroupManager options.
type UpdateInstanceGroupManagerOptions struct {
// The instance group identifier.
InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="`
// The instance group manager identifier.
ID *string `json:"id" validate:"required,ne="`
// The instance group manager patch.
InstanceGroupManagerPatch map[string]interface{} `json:"InstanceGroupManager_patch" 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 `json:"instance_group_id" validate:"required,ne="`
// The instance group manager identifier.
InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="`
// The instance group manager policy identifier.
ID *string `json:"id" validate:"required,ne="`
// The instance group manager policy patch.
InstanceGroupManagerPolicyPatch map[string]interface{} `json:"InstanceGroupManagerPolicy_patch" 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 `json:"instance_group_id" validate:"required,ne="`
// The instance group membership identifier.
ID *string `json:"id" validate:"required,ne="`
// The instance group membership patch.
InstanceGroupMembershipPatch map[string]interface{} `json:"InstanceGroupMembership_patch" 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 `json:"id" validate:"required,ne="`
// The instance group patch.
InstanceGroupPatch map[string]interface{} `json:"InstanceGroup_patch" 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
}
// UpdateInstanceNetworkAttachmentOptions : The UpdateInstanceNetworkAttachment options.
type UpdateInstanceNetworkAttachmentOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance network attachment identifier.
ID *string `json:"id" validate:"required,ne="`
// The instance network attachment patch.
InstanceNetworkAttachmentPatch map[string]interface{} `json:"InstanceNetworkAttachment_patch" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateInstanceNetworkAttachmentOptions : Instantiate UpdateInstanceNetworkAttachmentOptions
func (*VpcV1) NewUpdateInstanceNetworkAttachmentOptions(instanceID string, id string, instanceNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceNetworkAttachmentOptions {
return &UpdateInstanceNetworkAttachmentOptions{
InstanceID: core.StringPtr(instanceID),
ID: core.StringPtr(id),
InstanceNetworkAttachmentPatch: instanceNetworkAttachmentPatch,
}
}
// SetInstanceID : Allow user to set InstanceID
func (_options *UpdateInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *UpdateInstanceNetworkAttachmentOptions {
_options.InstanceID = core.StringPtr(instanceID)
return _options
}
// SetID : Allow user to set ID
func (_options *UpdateInstanceNetworkAttachmentOptions) SetID(id string) *UpdateInstanceNetworkAttachmentOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetInstanceNetworkAttachmentPatch : Allow user to set InstanceNetworkAttachmentPatch
func (_options *UpdateInstanceNetworkAttachmentOptions) SetInstanceNetworkAttachmentPatch(instanceNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceNetworkAttachmentOptions {
_options.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatch
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *UpdateInstanceNetworkAttachmentOptions {
options.Headers = param
return options
}
// UpdateInstanceNetworkInterfaceOptions : The UpdateInstanceNetworkInterface options.
type UpdateInstanceNetworkInterfaceOptions struct {
// The virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The instance network interface identifier.
ID *string `json:"id" validate:"required,ne="`
// The instance network interface patch.
NetworkInterfacePatch map[string]interface{} `json:"NetworkInterface_patch" 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 virtual server instance identifier.
ID *string `json:"id" validate:"required,ne="`
// The instance patch.
InstancePatch map[string]interface{} `json:"Instance_patch" validate:"required"`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
// Required if the request body includes an array.
IfMatch *string `json:"If-Match,omitempty"`
// 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
}
// SetIfMatch : Allow user to set IfMatch
func (_options *UpdateInstanceOptions) SetIfMatch(ifMatch string) *UpdateInstanceOptions {
_options.IfMatch = core.StringPtr(ifMatch)
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 `json:"id" validate:"required,ne="`
// The instance template patch.
InstanceTemplatePatch map[string]interface{} `json:"InstanceTemplate_patch" 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 virtual server instance identifier.
InstanceID *string `json:"instance_id" validate:"required,ne="`
// The volume attachment identifier.
ID *string `json:"id" validate:"required,ne="`
// The volume attachment patch.
VolumeAttachmentPatch map[string]interface{} `json:"VolumeAttachment_patch" 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 `json:"id" validate:"required,ne="`
// The IPsec policy patch.
IPsecPolicyPatch map[string]interface{} `json:"IPsecPolicy_patch" 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 `json:"id" validate:"required,ne="`
// The key patch.
KeyPatch map[string]interface{} `json:"Key_patch" 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 `json:"load_balancer_id" validate:"required,ne="`
// The listener identifier.
ID *string `json:"id" validate:"required,ne="`
// The load balancer listener patch.
LoadBalancerListenerPatch map[string]interface{} `json:"LoadBalancerListener_patch" 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 `json:"load_balancer_id" validate:"required,ne="`
// The listener identifier.
ListenerID *string `json:"listener_id" validate:"required,ne="`
// The policy identifier.
ID *string `json:"id" validate:"required,ne="`
// The listener policy patch.
LoadBalancerListenerPolicyPatch map[string]interface{} `json:"LoadBalancerListenerPolicy_patch" 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 `json:"load_balancer_id" validate:"required,ne="`
// The listener identifier.
ListenerID *string `json:"listener_id" validate:"required,ne="`
// The policy identifier.
PolicyID *string `json:"policy_id" validate:"required,ne="`
// The rule identifier.
ID *string `json:"id" validate:"required,ne="`
// The listener policy rule patch.
LoadBalancerListenerPolicyRulePatch map[string]interface{} `json:"LoadBalancerListenerPolicyRule_patch" 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 `json:"id" validate:"required,ne="`
// The load balancer patch.
LoadBalancerPatch map[string]interface{} `json:"LoadBalancer_patch" validate:"required"`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
// Required if the request body includes an array.
IfMatch *string `json:"If-Match,omitempty"`
// 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
}
// SetIfMatch : Allow user to set IfMatch
func (_options *UpdateLoadBalancerOptions) SetIfMatch(ifMatch string) *UpdateLoadBalancerOptions {
_options.IfMatch = core.StringPtr(ifMatch)
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 `json:"load_balancer_id" validate:"required,ne="`
// The pool identifier.
PoolID *string `json:"pool_id" validate:"required,ne="`
// The member identifier.
ID *string `json:"id" validate:"required,ne="`
// The load balancer pool member patch.
LoadBalancerPoolMemberPatch map[string]interface{} `json:"LoadBalancerPoolMember_patch" 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 `json:"load_balancer_id" validate:"required,ne="`
// The pool identifier.
ID *string `json:"id" validate:"required,ne="`
// The load balancer pool patch.
LoadBalancerPoolPatch map[string]interface{} `json:"LoadBalancerPool_patch" 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 `json:"id" validate:"required,ne="`
// The network ACL patch.
NetworkACLPatch map[string]interface{} `json:"NetworkACL_patch" 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 `json:"network_acl_id" validate:"required,ne="`
// The rule identifier.
ID *string `json:"id" validate:"required,ne="`
// The network ACL rule patch.
NetworkACLRulePatch map[string]interface{} `json:"NetworkACLRule_patch" 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
}
// UpdatePlacementGroupOptions : The UpdatePlacementGroup options.
type UpdatePlacementGroupOptions struct {
// The placement group identifier.
ID *string `json:"id" validate:"required,ne="`
// The placement group patch.
PlacementGroupPatch map[string]interface{} `json:"PlacementGroup_patch" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdatePlacementGroupOptions : Instantiate UpdatePlacementGroupOptions
func (*VpcV1) NewUpdatePlacementGroupOptions(id string, placementGroupPatch map[string]interface{}) *UpdatePlacementGroupOptions {
return &UpdatePlacementGroupOptions{
ID: core.StringPtr(id),
PlacementGroupPatch: placementGroupPatch,
}
}
// SetID : Allow user to set ID
func (_options *UpdatePlacementGroupOptions) SetID(id string) *UpdatePlacementGroupOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetPlacementGroupPatch : Allow user to set PlacementGroupPatch
func (_options *UpdatePlacementGroupOptions) SetPlacementGroupPatch(placementGroupPatch map[string]interface{}) *UpdatePlacementGroupOptions {
_options.PlacementGroupPatch = placementGroupPatch
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdatePlacementGroupOptions) SetHeaders(param map[string]string) *UpdatePlacementGroupOptions {
options.Headers = param
return options
}
// UpdatePrivatePathServiceGatewayAccountPolicyOptions : The UpdatePrivatePathServiceGatewayAccountPolicy options.
type UpdatePrivatePathServiceGatewayAccountPolicyOptions struct {
// The private path service gateway identifier.
PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="`
// The account policy identifier.
ID *string `json:"id" validate:"required,ne="`
// The account policy patch.
PrivatePathServiceGatewayAccountPolicyPatch map[string]interface{} `json:"PrivatePathServiceGatewayAccountPolicy_patch" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdatePrivatePathServiceGatewayAccountPolicyOptions : Instantiate UpdatePrivatePathServiceGatewayAccountPolicyOptions
func (*VpcV1) NewUpdatePrivatePathServiceGatewayAccountPolicyOptions(privatePathServiceGatewayID string, id string, privatePathServiceGatewayAccountPolicyPatch map[string]interface{}) *UpdatePrivatePathServiceGatewayAccountPolicyOptions {
return &UpdatePrivatePathServiceGatewayAccountPolicyOptions{
PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID),
ID: core.StringPtr(id),
PrivatePathServiceGatewayAccountPolicyPatch: privatePathServiceGatewayAccountPolicyPatch,
}
}
// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID
func (_options *UpdatePrivatePathServiceGatewayAccountPolicyOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *UpdatePrivatePathServiceGatewayAccountPolicyOptions {
_options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID)
return _options
}
// SetID : Allow user to set ID
func (_options *UpdatePrivatePathServiceGatewayAccountPolicyOptions) SetID(id string) *UpdatePrivatePathServiceGatewayAccountPolicyOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetPrivatePathServiceGatewayAccountPolicyPatch : Allow user to set PrivatePathServiceGatewayAccountPolicyPatch
func (_options *UpdatePrivatePathServiceGatewayAccountPolicyOptions) SetPrivatePathServiceGatewayAccountPolicyPatch(privatePathServiceGatewayAccountPolicyPatch map[string]interface{}) *UpdatePrivatePathServiceGatewayAccountPolicyOptions {
_options.PrivatePathServiceGatewayAccountPolicyPatch = privatePathServiceGatewayAccountPolicyPatch
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdatePrivatePathServiceGatewayAccountPolicyOptions) SetHeaders(param map[string]string) *UpdatePrivatePathServiceGatewayAccountPolicyOptions {
options.Headers = param
return options
}
// UpdatePrivatePathServiceGatewayOptions : The UpdatePrivatePathServiceGateway options.
type UpdatePrivatePathServiceGatewayOptions struct {
// The private path service gateway identifier.
ID *string `json:"id" validate:"required,ne="`
// The private path service gateway patch.
PrivatePathServiceGatewayPatch map[string]interface{} `json:"PrivatePathServiceGateway_patch" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdatePrivatePathServiceGatewayOptions : Instantiate UpdatePrivatePathServiceGatewayOptions
func (*VpcV1) NewUpdatePrivatePathServiceGatewayOptions(id string, privatePathServiceGatewayPatch map[string]interface{}) *UpdatePrivatePathServiceGatewayOptions {
return &UpdatePrivatePathServiceGatewayOptions{
ID: core.StringPtr(id),
PrivatePathServiceGatewayPatch: privatePathServiceGatewayPatch,
}
}
// SetID : Allow user to set ID
func (_options *UpdatePrivatePathServiceGatewayOptions) SetID(id string) *UpdatePrivatePathServiceGatewayOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetPrivatePathServiceGatewayPatch : Allow user to set PrivatePathServiceGatewayPatch
func (_options *UpdatePrivatePathServiceGatewayOptions) SetPrivatePathServiceGatewayPatch(privatePathServiceGatewayPatch map[string]interface{}) *UpdatePrivatePathServiceGatewayOptions {
_options.PrivatePathServiceGatewayPatch = privatePathServiceGatewayPatch
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdatePrivatePathServiceGatewayOptions) SetHeaders(param map[string]string) *UpdatePrivatePathServiceGatewayOptions {
options.Headers = param
return options
}
// UpdatePublicAddressRangeOptions : The UpdatePublicAddressRange options.
type UpdatePublicAddressRangeOptions struct {
// The public address range identifier.
ID *string `json:"id" validate:"required,ne="`
// The public address range patch.
PublicAddressRangePatch map[string]interface{} `json:"PublicAddressRange_patch" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdatePublicAddressRangeOptions : Instantiate UpdatePublicAddressRangeOptions
func (*VpcV1) NewUpdatePublicAddressRangeOptions(id string, publicAddressRangePatch map[string]interface{}) *UpdatePublicAddressRangeOptions {
return &UpdatePublicAddressRangeOptions{
ID: core.StringPtr(id),
PublicAddressRangePatch: publicAddressRangePatch,
}
}
// SetID : Allow user to set ID
func (_options *UpdatePublicAddressRangeOptions) SetID(id string) *UpdatePublicAddressRangeOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetPublicAddressRangePatch : Allow user to set PublicAddressRangePatch
func (_options *UpdatePublicAddressRangeOptions) SetPublicAddressRangePatch(publicAddressRangePatch map[string]interface{}) *UpdatePublicAddressRangeOptions {
_options.PublicAddressRangePatch = publicAddressRangePatch
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdatePublicAddressRangeOptions) SetHeaders(param map[string]string) *UpdatePublicAddressRangeOptions {
options.Headers = param
return options
}
// UpdatePublicGatewayOptions : The UpdatePublicGateway options.
type UpdatePublicGatewayOptions struct {
// The public gateway identifier.
ID *string `json:"id" validate:"required,ne="`
// The public gateway patch.
PublicGatewayPatch map[string]interface{} `json:"PublicGateway_patch" 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
}
// UpdateReservationOptions : The UpdateReservation options.
type UpdateReservationOptions struct {
// The reservation identifier.
ID *string `json:"id" validate:"required,ne="`
// The reservation patch.
ReservationPatch map[string]interface{} `json:"Reservation_patch" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateReservationOptions : Instantiate UpdateReservationOptions
func (*VpcV1) NewUpdateReservationOptions(id string, reservationPatch map[string]interface{}) *UpdateReservationOptions {
return &UpdateReservationOptions{
ID: core.StringPtr(id),
ReservationPatch: reservationPatch,
}
}
// SetID : Allow user to set ID
func (_options *UpdateReservationOptions) SetID(id string) *UpdateReservationOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetReservationPatch : Allow user to set ReservationPatch
func (_options *UpdateReservationOptions) SetReservationPatch(reservationPatch map[string]interface{}) *UpdateReservationOptions {
_options.ReservationPatch = reservationPatch
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateReservationOptions) SetHeaders(param map[string]string) *UpdateReservationOptions {
options.Headers = param
return options
}
// UpdateSecurityGroupOptions : The UpdateSecurityGroup options.
type UpdateSecurityGroupOptions struct {
// The security group identifier.
ID *string `json:"id" validate:"required,ne="`
// The security group patch.
SecurityGroupPatch map[string]interface{} `json:"SecurityGroup_patch" 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 `json:"security_group_id" validate:"required,ne="`
// The rule identifier.
ID *string `json:"id" validate:"required,ne="`
// The security group rule patch.
SecurityGroupRulePatch map[string]interface{} `json:"SecurityGroupRule_patch" 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
}
// UpdateShareMountTargetOptions : The UpdateShareMountTarget options.
type UpdateShareMountTargetOptions struct {
// The file share identifier.
ShareID *string `json:"share_id" validate:"required,ne="`
// The file share mount target identifier.
ID *string `json:"id" validate:"required,ne="`
// The share mount target patch.
ShareMountTargetPatch map[string]interface{} `json:"ShareMountTarget_patch" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateShareMountTargetOptions : Instantiate UpdateShareMountTargetOptions
func (*VpcV1) NewUpdateShareMountTargetOptions(shareID string, id string, shareMountTargetPatch map[string]interface{}) *UpdateShareMountTargetOptions {
return &UpdateShareMountTargetOptions{
ShareID: core.StringPtr(shareID),
ID: core.StringPtr(id),
ShareMountTargetPatch: shareMountTargetPatch,
}
}
// SetShareID : Allow user to set ShareID
func (_options *UpdateShareMountTargetOptions) SetShareID(shareID string) *UpdateShareMountTargetOptions {
_options.ShareID = core.StringPtr(shareID)
return _options
}
// SetID : Allow user to set ID
func (_options *UpdateShareMountTargetOptions) SetID(id string) *UpdateShareMountTargetOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetShareMountTargetPatch : Allow user to set ShareMountTargetPatch
func (_options *UpdateShareMountTargetOptions) SetShareMountTargetPatch(shareMountTargetPatch map[string]interface{}) *UpdateShareMountTargetOptions {
_options.ShareMountTargetPatch = shareMountTargetPatch
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateShareMountTargetOptions) SetHeaders(param map[string]string) *UpdateShareMountTargetOptions {
options.Headers = param
return options
}
// UpdateShareOptions : The UpdateShare options.
type UpdateShareOptions struct {
// The file share identifier.
ID *string `json:"id" validate:"required,ne="`
// The file share patch.
SharePatch map[string]interface{} `json:"Share_patch" validate:"required"`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
// Required if the request body includes an array.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateShareOptions : Instantiate UpdateShareOptions
func (*VpcV1) NewUpdateShareOptions(id string, sharePatch map[string]interface{}) *UpdateShareOptions {
return &UpdateShareOptions{
ID: core.StringPtr(id),
SharePatch: sharePatch,
}
}
// SetID : Allow user to set ID
func (_options *UpdateShareOptions) SetID(id string) *UpdateShareOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetSharePatch : Allow user to set SharePatch
func (_options *UpdateShareOptions) SetSharePatch(sharePatch map[string]interface{}) *UpdateShareOptions {
_options.SharePatch = sharePatch
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *UpdateShareOptions) SetIfMatch(ifMatch string) *UpdateShareOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateShareOptions) SetHeaders(param map[string]string) *UpdateShareOptions {
options.Headers = param
return options
}
// UpdateShareSnapshotOptions : The UpdateShareSnapshot options.
type UpdateShareSnapshotOptions struct {
// The file share identifier.
ShareID *string `json:"share_id" validate:"required,ne="`
// The share snapshot identifier.
ID *string `json:"id" validate:"required,ne="`
// The share snapshot patch.
ShareSnapshotPatch map[string]interface{} `json:"ShareSnapshot_patch" validate:"required"`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
// Required if the request body includes an array.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateShareSnapshotOptions : Instantiate UpdateShareSnapshotOptions
func (*VpcV1) NewUpdateShareSnapshotOptions(shareID string, id string, shareSnapshotPatch map[string]interface{}) *UpdateShareSnapshotOptions {
return &UpdateShareSnapshotOptions{
ShareID: core.StringPtr(shareID),
ID: core.StringPtr(id),
ShareSnapshotPatch: shareSnapshotPatch,
}
}
// SetShareID : Allow user to set ShareID
func (_options *UpdateShareSnapshotOptions) SetShareID(shareID string) *UpdateShareSnapshotOptions {
_options.ShareID = core.StringPtr(shareID)
return _options
}
// SetID : Allow user to set ID
func (_options *UpdateShareSnapshotOptions) SetID(id string) *UpdateShareSnapshotOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetShareSnapshotPatch : Allow user to set ShareSnapshotPatch
func (_options *UpdateShareSnapshotOptions) SetShareSnapshotPatch(shareSnapshotPatch map[string]interface{}) *UpdateShareSnapshotOptions {
_options.ShareSnapshotPatch = shareSnapshotPatch
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *UpdateShareSnapshotOptions) SetIfMatch(ifMatch string) *UpdateShareSnapshotOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateShareSnapshotOptions) SetHeaders(param map[string]string) *UpdateShareSnapshotOptions {
options.Headers = param
return options
}
// UpdateSnapshotConsistencyGroupOptions : The UpdateSnapshotConsistencyGroup options.
type UpdateSnapshotConsistencyGroupOptions struct {
// The snapshot consistency group identifier.
ID *string `json:"id" validate:"required,ne="`
// The snapshot consistency group patch.
SnapshotConsistencyGroupPatch map[string]interface{} `json:"SnapshotConsistencyGroup_patch" validate:"required"`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
// Required if the request body includes an array.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateSnapshotConsistencyGroupOptions : Instantiate UpdateSnapshotConsistencyGroupOptions
func (*VpcV1) NewUpdateSnapshotConsistencyGroupOptions(id string, snapshotConsistencyGroupPatch map[string]interface{}) *UpdateSnapshotConsistencyGroupOptions {
return &UpdateSnapshotConsistencyGroupOptions{
ID: core.StringPtr(id),
SnapshotConsistencyGroupPatch: snapshotConsistencyGroupPatch,
}
}
// SetID : Allow user to set ID
func (_options *UpdateSnapshotConsistencyGroupOptions) SetID(id string) *UpdateSnapshotConsistencyGroupOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetSnapshotConsistencyGroupPatch : Allow user to set SnapshotConsistencyGroupPatch
func (_options *UpdateSnapshotConsistencyGroupOptions) SetSnapshotConsistencyGroupPatch(snapshotConsistencyGroupPatch map[string]interface{}) *UpdateSnapshotConsistencyGroupOptions {
_options.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatch
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *UpdateSnapshotConsistencyGroupOptions) SetIfMatch(ifMatch string) *UpdateSnapshotConsistencyGroupOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateSnapshotConsistencyGroupOptions) SetHeaders(param map[string]string) *UpdateSnapshotConsistencyGroupOptions {
options.Headers = param
return options
}
// UpdateSnapshotOptions : The UpdateSnapshot options.
type UpdateSnapshotOptions struct {
// The snapshot identifier.
ID *string `json:"id" validate:"required,ne="`
// The snapshot patch.
SnapshotPatch map[string]interface{} `json:"Snapshot_patch" validate:"required"`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
// Required if the request body includes an array.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateSnapshotOptions : Instantiate UpdateSnapshotOptions
func (*VpcV1) NewUpdateSnapshotOptions(id string, snapshotPatch map[string]interface{}) *UpdateSnapshotOptions {
return &UpdateSnapshotOptions{
ID: core.StringPtr(id),
SnapshotPatch: snapshotPatch,
}
}
// SetID : Allow user to set ID
func (_options *UpdateSnapshotOptions) SetID(id string) *UpdateSnapshotOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetSnapshotPatch : Allow user to set SnapshotPatch
func (_options *UpdateSnapshotOptions) SetSnapshotPatch(snapshotPatch map[string]interface{}) *UpdateSnapshotOptions {
_options.SnapshotPatch = snapshotPatch
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *UpdateSnapshotOptions) SetIfMatch(ifMatch string) *UpdateSnapshotOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateSnapshotOptions) SetHeaders(param map[string]string) *UpdateSnapshotOptions {
options.Headers = param
return options
}
// UpdateSubnetOptions : The UpdateSubnet options.
type UpdateSubnetOptions struct {
// The subnet identifier.
ID *string `json:"id" validate:"required,ne="`
// The subnet patch.
SubnetPatch map[string]interface{} `json:"Subnet_patch" 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 `json:"subnet_id" validate:"required,ne="`
// The reserved IP identifier.
ID *string `json:"id" validate:"required,ne="`
// The reserved IP patch.
ReservedIPPatch map[string]interface{} `json:"ReservedIP_patch" 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
}
// UpdateVirtualNetworkInterfaceOptions : The UpdateVirtualNetworkInterface options.
type UpdateVirtualNetworkInterfaceOptions struct {
// The virtual network interface identifier.
ID *string `json:"id" validate:"required,ne="`
// The virtual network interface patch.
VirtualNetworkInterfacePatch map[string]interface{} `json:"VirtualNetworkInterface_patch" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateVirtualNetworkInterfaceOptions : Instantiate UpdateVirtualNetworkInterfaceOptions
func (*VpcV1) NewUpdateVirtualNetworkInterfaceOptions(id string, virtualNetworkInterfacePatch map[string]interface{}) *UpdateVirtualNetworkInterfaceOptions {
return &UpdateVirtualNetworkInterfaceOptions{
ID: core.StringPtr(id),
VirtualNetworkInterfacePatch: virtualNetworkInterfacePatch,
}
}
// SetID : Allow user to set ID
func (_options *UpdateVirtualNetworkInterfaceOptions) SetID(id string) *UpdateVirtualNetworkInterfaceOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetVirtualNetworkInterfacePatch : Allow user to set VirtualNetworkInterfacePatch
func (_options *UpdateVirtualNetworkInterfaceOptions) SetVirtualNetworkInterfacePatch(virtualNetworkInterfacePatch map[string]interface{}) *UpdateVirtualNetworkInterfaceOptions {
_options.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatch
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateVirtualNetworkInterfaceOptions {
options.Headers = param
return options
}
// UpdateVolumeOptions : The UpdateVolume options.
type UpdateVolumeOptions struct {
// The volume identifier.
ID *string `json:"id" validate:"required,ne="`
// The volume patch.
VolumePatch map[string]interface{} `json:"Volume_patch" validate:"required"`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
// Required if the request body includes an array.
IfMatch *string `json:"If-Match,omitempty"`
// 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
}
// SetIfMatch : Allow user to set IfMatch
func (_options *UpdateVolumeOptions) SetIfMatch(ifMatch string) *UpdateVolumeOptions {
_options.IfMatch = core.StringPtr(ifMatch)
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 `json:"vpc_id" validate:"required,ne="`
// The prefix identifier.
ID *string `json:"id" validate:"required,ne="`
// The prefix patch.
AddressPrefixPatch map[string]interface{} `json:"AddressPrefix_patch" 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
}
// UpdateVPCDnsResolutionBindingOptions : The UpdateVPCDnsResolutionBinding options.
type UpdateVPCDnsResolutionBindingOptions struct {
// The VPC identifier.
VPCID *string `json:"vpc_id" validate:"required,ne="`
// The DNS resolution binding identifier.
ID *string `json:"id" validate:"required,ne="`
// The DNS resolution binding patch.
VpcdnsResolutionBindingPatch map[string]interface{} `json:"VpcdnsResolutionBinding_patch" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateVPCDnsResolutionBindingOptions : Instantiate UpdateVPCDnsResolutionBindingOptions
func (*VpcV1) NewUpdateVPCDnsResolutionBindingOptions(vpcID string, id string, vpcdnsResolutionBindingPatch map[string]interface{}) *UpdateVPCDnsResolutionBindingOptions {
return &UpdateVPCDnsResolutionBindingOptions{
VPCID: core.StringPtr(vpcID),
ID: core.StringPtr(id),
VpcdnsResolutionBindingPatch: vpcdnsResolutionBindingPatch,
}
}
// SetVPCID : Allow user to set VPCID
func (_options *UpdateVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *UpdateVPCDnsResolutionBindingOptions {
_options.VPCID = core.StringPtr(vpcID)
return _options
}
// SetID : Allow user to set ID
func (_options *UpdateVPCDnsResolutionBindingOptions) SetID(id string) *UpdateVPCDnsResolutionBindingOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetVpcdnsResolutionBindingPatch : Allow user to set VpcdnsResolutionBindingPatch
func (_options *UpdateVPCDnsResolutionBindingOptions) SetVpcdnsResolutionBindingPatch(vpcdnsResolutionBindingPatch map[string]interface{}) *UpdateVPCDnsResolutionBindingOptions {
_options.VpcdnsResolutionBindingPatch = vpcdnsResolutionBindingPatch
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *UpdateVPCDnsResolutionBindingOptions {
options.Headers = param
return options
}
// UpdateVPCOptions : The UpdateVPC options.
type UpdateVPCOptions struct {
// The VPC identifier.
ID *string `json:"id" validate:"required,ne="`
// The VPC patch.
VPCPatch map[string]interface{} `json:"VPC_patch" validate:"required"`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
// Required if the request body includes an array.
IfMatch *string `json:"If-Match,omitempty"`
// 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
}
// SetIfMatch : Allow user to set IfMatch
func (_options *UpdateVPCOptions) SetIfMatch(ifMatch string) *UpdateVPCOptions {
_options.IfMatch = core.StringPtr(ifMatch)
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 `json:"vpc_id" validate:"required,ne="`
// The route identifier.
ID *string `json:"id" validate:"required,ne="`
// The route patch.
RoutePatch map[string]interface{} `json:"Route_patch" 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 `json:"vpc_id" validate:"required,ne="`
// The routing table identifier.
ID *string `json:"id" validate:"required,ne="`
// The routing table patch.
RoutingTablePatch map[string]interface{} `json:"RoutingTable_patch" validate:"required"`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
// Required if the request body includes an array.
IfMatch *string `json:"If-Match,omitempty"`
// 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
}
// SetIfMatch : Allow user to set IfMatch
func (_options *UpdateVPCRoutingTableOptions) SetIfMatch(ifMatch string) *UpdateVPCRoutingTableOptions {
_options.IfMatch = core.StringPtr(ifMatch)
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 `json:"vpc_id" validate:"required,ne="`
// The routing table identifier.
RoutingTableID *string `json:"routing_table_id" validate:"required,ne="`
// The VPC routing table route identifier.
ID *string `json:"id" validate:"required,ne="`
// The VPC route patch.
RoutePatch map[string]interface{} `json:"Route_patch" 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 `json:"vpn_gateway_id" validate:"required,ne="`
// The VPN gateway connection identifier.
ID *string `json:"id" validate:"required,ne="`
// The VPN gateway connection patch.
VPNGatewayConnectionPatch map[string]interface{} `json:"VPNGatewayConnection_patch" 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 `json:"id" validate:"required,ne="`
// The VPN gateway patch.
VPNGatewayPatch map[string]interface{} `json:"VPNGateway_patch" 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
}
// UpdateVPNServerOptions : The UpdateVPNServer options.
type UpdateVPNServerOptions struct {
// The VPN server identifier.
ID *string `json:"id" validate:"required,ne="`
// The VPN server patch.
VPNServerPatch map[string]interface{} `json:"VPNServer_patch" validate:"required"`
// If present, the request will fail if the specified ETag value does not match the resource's current ETag value.
// Required if the request body includes an array.
IfMatch *string `json:"If-Match,omitempty"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateVPNServerOptions : Instantiate UpdateVPNServerOptions
func (*VpcV1) NewUpdateVPNServerOptions(id string, vpnServerPatch map[string]interface{}) *UpdateVPNServerOptions {
return &UpdateVPNServerOptions{
ID: core.StringPtr(id),
VPNServerPatch: vpnServerPatch,
}
}
// SetID : Allow user to set ID
func (_options *UpdateVPNServerOptions) SetID(id string) *UpdateVPNServerOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetVPNServerPatch : Allow user to set VPNServerPatch
func (_options *UpdateVPNServerOptions) SetVPNServerPatch(vpnServerPatch map[string]interface{}) *UpdateVPNServerOptions {
_options.VPNServerPatch = vpnServerPatch
return _options
}
// SetIfMatch : Allow user to set IfMatch
func (_options *UpdateVPNServerOptions) SetIfMatch(ifMatch string) *UpdateVPNServerOptions {
_options.IfMatch = core.StringPtr(ifMatch)
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateVPNServerOptions) SetHeaders(param map[string]string) *UpdateVPNServerOptions {
options.Headers = param
return options
}
// UpdateVPNServerRouteOptions : The UpdateVPNServerRoute options.
type UpdateVPNServerRouteOptions struct {
// The VPN server identifier.
VPNServerID *string `json:"vpn_server_id" validate:"required,ne="`
// The VPN route identifier.
ID *string `json:"id" validate:"required,ne="`
// The VPN route patch.
VPNServerRoutePatch map[string]interface{} `json:"VPNServerRoute_patch" validate:"required"`
// Allows users to set headers on API requests.
Headers map[string]string
}
// NewUpdateVPNServerRouteOptions : Instantiate UpdateVPNServerRouteOptions
func (*VpcV1) NewUpdateVPNServerRouteOptions(vpnServerID string, id string, vpnServerRoutePatch map[string]interface{}) *UpdateVPNServerRouteOptions {
return &UpdateVPNServerRouteOptions{
VPNServerID: core.StringPtr(vpnServerID),
ID: core.StringPtr(id),
VPNServerRoutePatch: vpnServerRoutePatch,
}
}
// SetVPNServerID : Allow user to set VPNServerID
func (_options *UpdateVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *UpdateVPNServerRouteOptions {
_options.VPNServerID = core.StringPtr(vpnServerID)
return _options
}
// SetID : Allow user to set ID
func (_options *UpdateVPNServerRouteOptions) SetID(id string) *UpdateVPNServerRouteOptions {
_options.ID = core.StringPtr(id)
return _options
}
// SetVPNServerRoutePatch : Allow user to set VPNServerRoutePatch
func (_options *UpdateVPNServerRouteOptions) SetVPNServerRoutePatch(vpnServerRoutePatch map[string]interface{}) *UpdateVPNServerRouteOptions {
_options.VPNServerRoutePatch = vpnServerRoutePatch
return _options
}
// SetHeaders : Allow user to set Headers
func (options *UpdateVPNServerRouteOptions) SetHeaders(param map[string]string) *UpdateVPNServerRouteOptions {
options.Headers = param
return options
}
// Vcpu : The VCPU configuration.
type Vcpu struct {
// The VCPU architecture.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Architecture *string `json:"architecture" validate:"required"`
// The number of VCPUs assigned.
Count *int64 `json:"count" validate:"required"`
// The VCPU manufacturer.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Manufacturer *string `json:"manufacturer" validate:"required"`
}
// Constants associated with the Vcpu.Architecture property.
// The VCPU architecture.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
VcpuArchitectureAmd64Const = "amd64"
VcpuArchitectureS390xConst = "s390x"
)
// Constants associated with the Vcpu.Manufacturer property.
// The VCPU manufacturer.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
VcpuManufacturerAmdConst = "amd"
VcpuManufacturerIBMConst = "ibm"
VcpuManufacturerIntelConst = "intel"
)
// 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 {
err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "count", &obj.Count)
if err != nil {
err = core.SDKErrorf(err, "", "count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer)
if err != nil {
err = core.SDKErrorf(err, "", "manufacturer-error", common.GetComponentInfo())
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"`
// The CSE ([Cloud Service Endpoint](https://cloud.ibm.com/docs/account?topic=account-service-endpoints-overview))
// source IP addresses for the VPC. The VPC will have at least one CSE source IP address per zone.
//
// The maximum number of items for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 for this VPC. Resources created in this VPC that allow
// a security group to be optionally specified will use this security group by
// default.
DefaultSecurityGroup *SecurityGroupReference `json:"default_security_group" validate:"required"`
// The DNS configuration for this VPC.
Dns *Vpcdns `json:"dns" validate:"required"`
// The reasons for the current `health_state` (if any).
HealthReasons []VPCHealthReason `json:"health_reasons" validate:"required"`
// The health of this resource:
// - `ok`: No abnormal behavior detected
// - `degraded`: Experiencing 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 VPC.
Href *string `json:"href" validate:"required"`
// The unique identifier for this VPC.
ID *string `json:"id" validate:"required"`
// The name for this VPC. The name is unique across all VPCs in the region.
Name *string `json:"name" validate:"required"`
// The public address ranges attached to this VPC.
PublicAddressRanges []PublicAddressRangeReference `json:"public_address_ranges" validate:"required"`
// The resource group for this VPC.
ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The status of this VPC.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
}
// Constants associated with the VPC.HealthState property.
// The health of this resource:
// - `ok`: No abnormal behavior detected
// - `degraded`: Experiencing 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 (
VPCHealthStateDegradedConst = "degraded"
VPCHealthStateFaultedConst = "faulted"
VPCHealthStateInapplicableConst = "inapplicable"
VPCHealthStateOkConst = "ok"
)
// Constants associated with the VPC.ResourceType property.
// The resource type.
const (
VPCResourceTypeVPCConst = "vpc"
)
// Constants associated with the VPC.Status property.
// The status of this VPC.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 {
err = core.SDKErrorf(err, "", "classic_access-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "cse_source_ips", &obj.CseSourceIps, UnmarshalVpccseSourceIP)
if err != nil {
err = core.SDKErrorf(err, "", "cse_source_ips-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "default_network_acl", &obj.DefaultNetworkACL, UnmarshalNetworkACLReference)
if err != nil {
err = core.SDKErrorf(err, "", "default_network_acl-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "default_routing_table", &obj.DefaultRoutingTable, UnmarshalRoutingTableReference)
if err != nil {
err = core.SDKErrorf(err, "", "default_routing_table-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "default_security_group", &obj.DefaultSecurityGroup, UnmarshalSecurityGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "default_security_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalVpcdns)
if err != nil {
err = core.SDKErrorf(err, "", "dns-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPCHealthReason)
if err != nil {
err = core.SDKErrorf(err, "", "health_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState)
if err != nil {
err = core.SDKErrorf(err, "", "health_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "public_address_ranges", &obj.PublicAddressRanges, UnmarshalPublicAddressRangeReference)
if err != nil {
err = core.SDKErrorf(err, "", "public_address_ranges-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VpccseSourceIP : VpccseSourceIP struct
type VpccseSourceIP struct {
// A 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 {
err = core.SDKErrorf(err, "", "ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference)
if err != nil {
err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo())
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 *PageLink `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
// A page 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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpcs", &obj.Vpcs, UnmarshalVPC)
if err != nil {
err = core.SDKErrorf(err, "", "vpcs-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *VPCCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// Vpcdns : The DNS configuration for this VPC.
type Vpcdns struct {
// Indicates whether this VPC is enabled as a DNS name resolution hub.
EnableHub *bool `json:"enable_hub" validate:"required"`
// The number of DNS resolution bindings for this VPC.
ResolutionBindingCount *int64 `json:"resolution_binding_count" validate:"required"`
// The DNS resolver configuration for the VPC.
Resolver VpcdnsResolverIntf `json:"resolver" validate:"required"`
}
// UnmarshalVpcdns unmarshals an instance of Vpcdns from the specified map of raw messages.
func UnmarshalVpcdns(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(Vpcdns)
err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub)
if err != nil {
err = core.SDKErrorf(err, "", "enable_hub-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resolution_binding_count", &obj.ResolutionBindingCount)
if err != nil {
err = core.SDKErrorf(err, "", "resolution_binding_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolver)
if err != nil {
err = core.SDKErrorf(err, "", "resolver-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VpcdnsPatch : The DNS configuration for this VPC.
type VpcdnsPatch struct {
// Indicates whether this VPC is enabled as a DNS name resolution hub.
//
// Updating the value to `true` requires `allow_dns_resolution_binding` to be `true` for all endpoint gateways residing
// in this VPC.
//
// Changing the value requires `dns.resolution_binding_count` to be zero.
EnableHub *bool `json:"enable_hub,omitempty"`
Resolver *VpcdnsResolverPatch `json:"resolver,omitempty"`
}
// UnmarshalVpcdnsPatch unmarshals an instance of VpcdnsPatch from the specified map of raw messages.
func UnmarshalVpcdnsPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VpcdnsPatch)
err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub)
if err != nil {
err = core.SDKErrorf(err, "", "enable_hub-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolverPatch)
if err != nil {
err = core.SDKErrorf(err, "", "resolver-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the VpcdnsPatch
func (vpcdnsPatch *VpcdnsPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(vpcdnsPatch.EnableHub) {
_patch["enable_hub"] = vpcdnsPatch.EnableHub
}
if !core.IsNil(vpcdnsPatch.Resolver) {
_patch["resolver"] = vpcdnsPatch.Resolver.asPatch()
}
return
}
// VpcdnsPrototype : The DNS configuration for this VPC.
//
// If unspecified, the system will assign DNS servers capable of resolving hosts and endpoint gateways within this VPC,
// and hosts on the internet.
type VpcdnsPrototype struct {
// Indicates whether this VPC is enabled as a DNS name resolution hub.
EnableHub *bool `json:"enable_hub,omitempty"`
Resolver VpcdnsResolverPrototypeIntf `json:"resolver,omitempty"`
}
// UnmarshalVpcdnsPrototype unmarshals an instance of VpcdnsPrototype from the specified map of raw messages.
func UnmarshalVpcdnsPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VpcdnsPrototype)
err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub)
if err != nil {
err = core.SDKErrorf(err, "", "enable_hub-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolverPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "resolver-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VpcdnsResolutionBinding : VpcdnsResolutionBinding struct
type VpcdnsResolutionBinding struct {
// The date and time that the DNS resolution binding was created.
CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"`
// The endpoint gateways that have `allow_dns_resolution_binding` set to `true` and reside in the VPC that has
// `dns.enable_hub` set to `false`.
//
// The endpoint gateways may be remote and therefore may not be directly retrievable.
EndpointGateways []EndpointGatewayReferenceRemote `json:"endpoint_gateways" validate:"required"`
// The reasons for the current `health_state` (if any).
HealthReasons []VpcdnsResolutionBindingHealthReason `json:"health_reasons" validate:"required"`
// The health of this resource:
// - `ok`: No abnormal behavior detected
// - `degraded`: Experiencing 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 DNS resolution binding.
Href *string `json:"href" validate:"required"`
// The unique identifier for this DNS resolution binding.
ID *string `json:"id" validate:"required"`
// The lifecycle state of the DNS resolution binding.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The name for this DNS resolution binding. The name is unique across all DNS resolution bindings for the VPC.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
// The VPC bound to for DNS resolution.
//
// The VPC may be remote and therefore may not be directly retrievable.
VPC *VPCReferenceRemote `json:"vpc" validate:"required"`
}
// Constants associated with the VpcdnsResolutionBinding.HealthState property.
// The health of this resource:
// - `ok`: No abnormal behavior detected
// - `degraded`: Experiencing 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 (
VpcdnsResolutionBindingHealthStateDegradedConst = "degraded"
VpcdnsResolutionBindingHealthStateFaultedConst = "faulted"
VpcdnsResolutionBindingHealthStateInapplicableConst = "inapplicable"
VpcdnsResolutionBindingHealthStateOkConst = "ok"
)
// Constants associated with the VpcdnsResolutionBinding.LifecycleState property.
// The lifecycle state of the DNS resolution binding.
const (
VpcdnsResolutionBindingLifecycleStateDeletingConst = "deleting"
VpcdnsResolutionBindingLifecycleStateFailedConst = "failed"
VpcdnsResolutionBindingLifecycleStatePendingConst = "pending"
VpcdnsResolutionBindingLifecycleStateStableConst = "stable"
VpcdnsResolutionBindingLifecycleStateSuspendedConst = "suspended"
VpcdnsResolutionBindingLifecycleStateUpdatingConst = "updating"
VpcdnsResolutionBindingLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the VpcdnsResolutionBinding.ResourceType property.
// The resource type.
const (
VpcdnsResolutionBindingResourceTypeVPCDnsResolutionBindingConst = "vpc_dns_resolution_binding"
)
// UnmarshalVpcdnsResolutionBinding unmarshals an instance of VpcdnsResolutionBinding from the specified map of raw messages.
func UnmarshalVpcdnsResolutionBinding(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VpcdnsResolutionBinding)
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "endpoint_gateways", &obj.EndpointGateways, UnmarshalEndpointGatewayReferenceRemote)
if err != nil {
err = core.SDKErrorf(err, "", "endpoint_gateways-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVpcdnsResolutionBindingHealthReason)
if err != nil {
err = core.SDKErrorf(err, "", "health_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState)
if err != nil {
err = core.SDKErrorf(err, "", "health_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceRemote)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VpcdnsResolutionBindingCollection : VpcdnsResolutionBindingCollection struct
type VpcdnsResolutionBindingCollection struct {
// A page of DNS resolution bindings for the VPC.
DnsResolutionBindings []VpcdnsResolutionBinding `json:"dns_resolution_bindings" validate:"required"`
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
}
// UnmarshalVpcdnsResolutionBindingCollection unmarshals an instance of VpcdnsResolutionBindingCollection from the specified map of raw messages.
func UnmarshalVpcdnsResolutionBindingCollection(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VpcdnsResolutionBindingCollection)
err = core.UnmarshalModel(m, "dns_resolution_bindings", &obj.DnsResolutionBindings, UnmarshalVpcdnsResolutionBinding)
if err != nil {
err = core.SDKErrorf(err, "", "dns_resolution_bindings-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *VpcdnsResolutionBindingCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// VpcdnsResolutionBindingHealthReason : VpcdnsResolutionBindingHealthReason struct
type VpcdnsResolutionBindingHealthReason struct {
// A reason code for this health state.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this health state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this health state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the VpcdnsResolutionBindingHealthReason.Code property.
// A reason code for this health state.
const (
VpcdnsResolutionBindingHealthReasonCodeDisconnectedFromBoundVPCConst = "disconnected_from_bound_vpc"
VpcdnsResolutionBindingHealthReasonCodeInternalErrorConst = "internal_error"
)
// UnmarshalVpcdnsResolutionBindingHealthReason unmarshals an instance of VpcdnsResolutionBindingHealthReason from the specified map of raw messages.
func UnmarshalVpcdnsResolutionBindingHealthReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VpcdnsResolutionBindingHealthReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VpcdnsResolutionBindingPatch : VpcdnsResolutionBindingPatch struct
type VpcdnsResolutionBindingPatch struct {
// The name for this DNS resolution binding. The name must not be used by another DNS resolution binding for the VPC.
Name *string `json:"name,omitempty"`
}
// UnmarshalVpcdnsResolutionBindingPatch unmarshals an instance of VpcdnsResolutionBindingPatch from the specified map of raw messages.
func UnmarshalVpcdnsResolutionBindingPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VpcdnsResolutionBindingPatch)
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the VpcdnsResolutionBindingPatch
func (vpcdnsResolutionBindingPatch *VpcdnsResolutionBindingPatch) AsPatch() (_patch map[string]interface{}, err error) {
_patch = map[string]interface{}{}
if !core.IsNil(vpcdnsResolutionBindingPatch.Name) {
_patch["name"] = vpcdnsResolutionBindingPatch.Name
}
return
}
// VpcdnsResolver : VpcdnsResolver struct
// Models which "extend" this model:
// - VpcdnsResolverTypeDelegated
// - VpcdnsResolverTypeManual
// - VpcdnsResolverTypeSystem
type VpcdnsResolver struct {
// The DNS servers for this VPC. The servers are populated:
//
// - by the system when `dns.resolver.type` is `system`
// - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated`
// - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`
//
// The maximum number of DNS servers is expected to
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Servers []DnsServer `json:"servers" validate:"required"`
// The type of the DNS resolver used for the VPC.
//
// - `delegated`: DNS server addresses are provided by the DNS resolver of the VPC
// specified in `dns.resolver.vpc`.
// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`.
// - `system`: DNS server addresses are provided by the system.
//
// The maximum number of DNS servers is expected to
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Type *string `json:"type" validate:"required"`
// The VPC whose DNS resolver provides the DNS server addresses for this VPC.
//
// The VPC may be remote and therefore may not be directly retrievable.
VPC *VPCReferenceDnsResolverContext `json:"vpc,omitempty"`
// The manually specified DNS servers for this VPC.
//
// If the DNS servers have `zone_affinity`, the DHCP [Domain Name Server
// Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list the DNS server with the
// affinity for that zone first, followed by the unique DNS servers from other zones.
//
// If the DNS servers do not have `zone_affinity`, the DHCP [Domain Name Server
// Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS
// servers in the order specified.
//
// The maximum number of manual DNS servers is expected to
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
ManualServers []DnsServer `json:"manual_servers,omitempty"`
// The configuration of the system DNS resolver for this VPC.
//
// - `custom_resolver`: A custom DNS resolver is configured for this VPC.
//
// - `private_resolver`: A private DNS resolver is configured for this VPC. Applies when
// the VPC has either or both of the following:
//
// - at least one endpoint gateway residing in it
// - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it
//
// - `default`: The provider default DNS resolvers are configured for this VPC.
//
// This system DNS resolver configuration is used when the VPC has:
//
// - no custom DNS resolver configured for it, and
// - no endpoint gateways residing in it, and
// - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it.
Configuration *string `json:"configuration,omitempty"`
}
// Constants associated with the VpcdnsResolver.Type property.
// The type of the DNS resolver used for the VPC.
//
// - `delegated`: DNS server addresses are provided by the DNS resolver of the VPC
// specified in `dns.resolver.vpc`.
// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`.
// - `system`: DNS server addresses are provided by the system.
//
// The maximum number of DNS servers is expected to
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
VpcdnsResolverTypeDelegatedConst = "delegated"
VpcdnsResolverTypeManualConst = "manual"
VpcdnsResolverTypeSystemConst = "system"
)
// Constants associated with the VpcdnsResolver.Configuration property.
// The configuration of the system DNS resolver for this VPC.
//
// - `custom_resolver`: A custom DNS resolver is configured for this VPC.
//
// - `private_resolver`: A private DNS resolver is configured for this VPC. Applies when
// the VPC has either or both of the following:
//
// - at least one endpoint gateway residing in it
//
// - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it
//
// - `default`: The provider default DNS resolvers are configured for this VPC.
//
// This system DNS resolver configuration is used when the VPC has:
//
// - no custom DNS resolver configured for it, and
// - no endpoint gateways residing in it, and
// - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it.
const (
VpcdnsResolverConfigurationCustomResolverConst = "custom_resolver"
VpcdnsResolverConfigurationDefaultConst = "default"
VpcdnsResolverConfigurationPrivateResolverConst = "private_resolver"
)
func (*VpcdnsResolver) isaVpcdnsResolver() bool {
return true
}
type VpcdnsResolverIntf interface {
isaVpcdnsResolver() bool
}
// UnmarshalVpcdnsResolver unmarshals an instance of VpcdnsResolver from the specified map of raw messages.
func UnmarshalVpcdnsResolver(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VpcdnsResolver)
err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer)
if err != nil {
err = core.SDKErrorf(err, "", "servers-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceDnsResolverContext)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServer)
if err != nil {
err = core.SDKErrorf(err, "", "manual_servers-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "configuration", &obj.Configuration)
if err != nil {
err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VpcdnsResolverPatch : VpcdnsResolverPatch struct
type VpcdnsResolverPatch struct {
// The DNS servers to use for this VPC, replacing any existing servers. All the DNS servers must either:
//
// - have a unique `zone_affinity`, or
// - not have a `zone_affinity`.
//
// If `zone_affinity` is specified, exactly one DNS server must be specified for each zone in the region. The DHCP
// [Domain Name Server Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list this DNS
// server first, followed by unique DNS servers from other zones if available.
//
// If `zone_affinity` is not specified, the DHCP [Domain Name Server
// Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS
// servers in the order specified.
//
// `dns.resolver.manual_servers` must be set if and only if `dns.resolver.type` is `manual`.
ManualServers []DnsServerPrototype `json:"manual_servers,omitempty"`
// The type of the DNS resolver to use.
//
// - `delegated`: DNS server addresses will be provided by the resolver for the VPC
// specified in `dns.resolver.vpc`. Requires `dns.enable_hub` to be
// `false`.
// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`.
// - `system`: DNS server addresses will be provided by the system and depend on the
// configuration.
//
// Updating from `manual` requires `dns.resolver.manual_servers` to be specified as
// `null`.
//
// Updating to `manual` requires `dns.resolver.manual_servers` to be specified and not empty.
//
// Updating from `delegated` requires `dns.resolver.vpc` to be specified as `null`.
Type *string `json:"type,omitempty"`
// The VPC to provide DNS server addresses for this VPC. The specified VPC must be configured
// with a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) custom resolver and must be in
// one of this VPC's DNS resolution bindings.
//
// Specify `null` to remove an existing VPC.
//
// This property must be set if and only if `dns.resolver.type` is `delegated`.
VPC VpcdnsResolverVPCPatchIntf `json:"vpc,omitempty"`
}
// Constants associated with the VpcdnsResolverPatch.Type property.
// The type of the DNS resolver to use.
//
// - `delegated`: DNS server addresses will be provided by the resolver for the VPC
// specified in `dns.resolver.vpc`. Requires `dns.enable_hub` to be
// `false`.
// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`.
// - `system`: DNS server addresses will be provided by the system and depend on the
// configuration.
//
// Updating from `manual` requires `dns.resolver.manual_servers` to be specified as
// `null`.
//
// Updating to `manual` requires `dns.resolver.manual_servers` to be specified and not empty.
//
// Updating from `delegated` requires `dns.resolver.vpc` to be specified as `null`.
const (
VpcdnsResolverPatchTypeDelegatedConst = "delegated"
VpcdnsResolverPatchTypeManualConst = "manual"
VpcdnsResolverPatchTypeSystemConst = "system"
)
// UnmarshalVpcdnsResolverPatch unmarshals an instance of VpcdnsResolverPatch from the specified map of raw messages.
func UnmarshalVpcdnsResolverPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VpcdnsResolverPatch)
err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "manual_servers-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVpcdnsResolverVPCPatch)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the VpcdnsResolverPatch
func (vpcdnsResolverPatch *VpcdnsResolverPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(vpcdnsResolverPatch.ManualServers) {
var manualServersPatches []map[string]interface{}
for _, manualServers := range vpcdnsResolverPatch.ManualServers {
manualServersPatches = append(manualServersPatches, manualServers.asPatch())
}
_patch["manual_servers"] = manualServersPatches
}
if !core.IsNil(vpcdnsResolverPatch.Type) {
_patch["type"] = vpcdnsResolverPatch.Type
}
if !core.IsNil(vpcdnsResolverPatch.VPC) {
_patch["vpc"] = vpcdnsResolverPatch.VPC.asPatch()
}
return
}
// VpcdnsResolverPrototype : VpcdnsResolverPrototype struct
// Models which "extend" this model:
// - VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype
// - VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype
type VpcdnsResolverPrototype struct {
// The type of the DNS resolver to use.
//
// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`.
// - `system`: DNS server addresses will be provided by the system and depend on the
// configuration.
Type *string `json:"type,omitempty"`
// The DNS servers to use for this VPC. All the DNS servers must either:
//
// - have a unique `zone_affinity`, or
// - not have a `zone_affinity`.
//
// If `zone_affinity` is specified, exactly one DNS server must be specified for each zone in the region. The DHCP
// [Domain Name Server Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list this DNS
// server first, followed by unique DNS servers from other zones if available.
//
// If `zone_affinity` is not specified, the DHCP [Domain Name Server
// Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS
// servers in the order specified.
ManualServers []DnsServerPrototype `json:"manual_servers,omitempty"`
}
// Constants associated with the VpcdnsResolverPrototype.Type property.
// The type of the DNS resolver to use.
//
// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`.
// - `system`: DNS server addresses will be provided by the system and depend on the
// configuration.
const (
VpcdnsResolverPrototypeTypeManualConst = "manual"
VpcdnsResolverPrototypeTypeSystemConst = "system"
)
func (*VpcdnsResolverPrototype) isaVpcdnsResolverPrototype() bool {
return true
}
type VpcdnsResolverPrototypeIntf interface {
isaVpcdnsResolverPrototype() bool
}
// UnmarshalVpcdnsResolverPrototype unmarshals an instance of VpcdnsResolverPrototype from the specified map of raw messages.
func UnmarshalVpcdnsResolverPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VpcdnsResolverPrototype)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "manual_servers-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VpcdnsResolverVPCPatch : The VPC to provide DNS server addresses for this VPC. The specified VPC must be configured with a [DNS
// Services](https://cloud.ibm.com/docs/dns-svcs) custom resolver and must be in one of this VPC's DNS resolution
// bindings.
//
// Specify `null` to remove an existing VPC.
//
// This property must be set if and only if `dns.resolver.type` is `delegated`.
// Models which "extend" this model:
// - VpcdnsResolverVPCPatchVPCIdentityByID
// - VpcdnsResolverVPCPatchVPCIdentityByCRN
// - VpcdnsResolverVPCPatchVPCIdentityByHref
type VpcdnsResolverVPCPatch 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 (*VpcdnsResolverVPCPatch) isaVpcdnsResolverVPCPatch() bool {
return true
}
type VpcdnsResolverVPCPatchIntf interface {
isaVpcdnsResolverVPCPatch() bool
asPatch() map[string]interface{}
}
// UnmarshalVpcdnsResolverVPCPatch unmarshals an instance of VpcdnsResolverVPCPatch from the specified map of raw messages.
func UnmarshalVpcdnsResolverVPCPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VpcdnsResolverVPCPatch)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the VpcdnsResolverVPCPatch
func (vpcdnsResolverVPCPatch *VpcdnsResolverVPCPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(vpcdnsResolverVPCPatch.ID) {
_patch["id"] = vpcdnsResolverVPCPatch.ID
}
if !core.IsNil(vpcdnsResolverVPCPatch.CRN) {
_patch["crn"] = vpcdnsResolverVPCPatch.CRN
}
if !core.IsNil(vpcdnsResolverVPCPatch.Href) {
_patch["href"] = vpcdnsResolverVPCPatch.Href
}
return
}
// VPCHealthReason : VPCHealthReason struct
type VPCHealthReason struct {
// A reason code for this health state.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this health state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this health state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the VPCHealthReason.Code property.
// A reason code for this health state.
const (
VPCHealthReasonCodeDnsResolutionBindingFailedConst = "dns_resolution_binding_failed"
VPCHealthReasonCodeInternalErrorConst = "internal_error"
)
// UnmarshalVPCHealthReason unmarshals an instance of VPCHealthReason from the specified map of raw messages.
func UnmarshalVPCHealthReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPCHealthReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
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
asPatch() map[string]interface{}
}
// 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 {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the VPCIdentity
func (vpcIdentity *VPCIdentity) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(vpcIdentity.ID) {
_patch["id"] = vpcIdentity.ID
}
if !core.IsNil(vpcIdentity.CRN) {
_patch["crn"] = vpcIdentity.CRN
}
if !core.IsNil(vpcIdentity.Href) {
_patch["href"] = vpcIdentity.Href
}
return
}
// VPCPatch : VPCPatch struct
type VPCPatch struct {
// The DNS configuration for this VPC.
Dns *VpcdnsPatch `json:"dns,omitempty"`
// The name for this VPC. The name must not be used by another VPC in the region.
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.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalVpcdnsPatch)
if err != nil {
err = core.SDKErrorf(err, "", "dns-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(vpcPatch.Dns) {
_patch["dns"] = vpcPatch.Dns.asPatch()
}
if !core.IsNil(vpcPatch.Name) {
_patch["name"] = vpcPatch.Name
}
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 *Deleted `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 name for this VPC. The name is unique across all VPCs in the region.
Name *string `json:"name" validate:"required"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the VPCReference.ResourceType property.
// The resource type.
const (
VPCReferenceResourceTypeVPCConst = "vpc"
)
// 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 {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPCReferenceDnsResolverContext : A VPC whose DNS resolver is delegated to provide DNS servers for this VPC.
//
// The VPC may be remote and therefore may not be directly retrievable.
type VPCReferenceDnsResolverContext 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 *Deleted `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 name for this VPC. The name is unique across all VPCs in the region.
Name *string `json:"name" validate:"required"`
// If present, this property indicates that the resource associated with this reference
// is remote and therefore may not be directly retrievable.
Remote *VPCRemote `json:"remote,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the VPCReferenceDnsResolverContext.ResourceType property.
// The resource type.
const (
VPCReferenceDnsResolverContextResourceTypeVPCConst = "vpc"
)
// UnmarshalVPCReferenceDnsResolverContext unmarshals an instance of VPCReferenceDnsResolverContext from the specified map of raw messages.
func UnmarshalVPCReferenceDnsResolverContext(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPCReferenceDnsResolverContext)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVPCRemote)
if err != nil {
err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPCReferenceRemote : VPCReferenceRemote struct
type VPCReferenceRemote struct {
// The CRN for this VPC.
CRN *string `json:"crn" 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 name for this VPC. The name is unique across all VPCs in the region.
Name *string `json:"name" validate:"required"`
// If present, this property indicates that the resource associated with this reference
// is remote and therefore may not be directly retrievable.
Remote *VPCRemote `json:"remote,omitempty"`
// The resource type.
ResourceType *string `json:"resource_type" validate:"required"`
}
// Constants associated with the VPCReferenceRemote.ResourceType property.
// The resource type.
const (
VPCReferenceRemoteResourceTypeVPCConst = "vpc"
)
// UnmarshalVPCReferenceRemote unmarshals an instance of VPCReferenceRemote from the specified map of raw messages.
func UnmarshalVPCReferenceRemote(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPCReferenceRemote)
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVPCRemote)
if err != nil {
err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPCRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not
// be directly retrievable.
type VPCRemote struct {
// If present, this property indicates that the referenced resource is remote to this
// account, and identifies the owning account.
Account *AccountReference `json:"account,omitempty"`
// If present, this property indicates that the referenced resource is remote to this
// region, and identifies the native region.
Region *RegionReference `json:"region,omitempty"`
}
// UnmarshalVPCRemote unmarshals an instance of VPCRemote from the specified map of raw messages.
func UnmarshalVPCRemote(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPCRemote)
err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference)
if err != nil {
err = core.SDKErrorf(err, "", "account-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference)
if err != nil {
err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGateway : VPNGateway struct
// Models which "extend" this model:
// - VPNGatewayPolicyMode
// - VPNGatewayRouteMode
type VPNGateway struct {
// The connections for this VPN gateway.
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 CRN for this VPN gateway.
CRN *string `json:"crn" validate:"required"`
// The reasons for the current `health_state` (if any).
HealthReasons []VPNGatewayHealthReason `json:"health_reasons" validate:"required"`
// The health of this resource:
// - `ok`: No abnormal behavior detected
// - `degraded`: Experiencing 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 VPN gateway.
Href *string `json:"href" validate:"required"`
// The unique identifier for this VPN gateway.
ID *string `json:"id" validate:"required"`
// The reasons for the current `lifecycle_state` (if any).
LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"`
// The lifecycle state of the VPN gateway.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The members for the VPN gateway.
Members []VPNGatewayMember `json:"members" validate:"required"`
// The name for this VPN gateway. The name is unique across all VPN gateways in the VPC.
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"`
Subnet *SubnetReference `json:"subnet" validate:"required"`
// The VPC this VPN gateway resides in.
VPC *VPCReference `json:"vpc" validate:"required"`
// The mode for this VPN gateway.
Mode *string `json:"mode,omitempty"`
}
// Constants associated with the VPNGateway.HealthState property.
// The health of this resource:
// - `ok`: No abnormal behavior detected
// - `degraded`: Experiencing 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 (
VPNGatewayHealthStateDegradedConst = "degraded"
VPNGatewayHealthStateFaultedConst = "faulted"
VPNGatewayHealthStateInapplicableConst = "inapplicable"
VPNGatewayHealthStateOkConst = "ok"
)
// Constants associated with the VPNGateway.LifecycleState property.
// The lifecycle state of the VPN gateway.
const (
VPNGatewayLifecycleStateDeletingConst = "deleting"
VPNGatewayLifecycleStateFailedConst = "failed"
VPNGatewayLifecycleStatePendingConst = "pending"
VPNGatewayLifecycleStateStableConst = "stable"
VPNGatewayLifecycleStateSuspendedConst = "suspended"
VPNGatewayLifecycleStateUpdatingConst = "updating"
VPNGatewayLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the VPNGateway.ResourceType property.
// The resource type.
const (
VPNGatewayResourceTypeVPNGatewayConst = "vpn_gateway"
)
// Constants associated with the VPNGateway.Mode property.
// The mode for this VPN gateway.
const (
VPNGatewayModePolicyConst = "policy"
)
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 {
err = core.SDKErrorf(err, "", "connections-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt)
if err != nil {
err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
if err != nil {
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason)
if err != nil {
err = core.SDKErrorf(err, "", "health_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState)
if err != nil {
err = core.SDKErrorf(err, "", "health_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember)
if err != nil {
err = core.SDKErrorf(err, "", "members-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference)
if err != nil {
err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference)
if err != nil {
err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference)
if err != nil {
err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "mode", &obj.Mode)
if err != nil {
err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo())
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 *PageLink `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" validate:"required"`
// A page 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, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "vpn_gateways", &obj.VPNGateways, UnmarshalVPNGateway)
if err != nil {
err = core.SDKErrorf(err, "", "vpn_gateways-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *VPNGatewayCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// VPNGatewayConnection : VPNGatewayConnection struct
// Models which "extend" this model:
// - VPNGatewayConnectionRouteMode
// - 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.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 configuration.
DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"`
// The establish mode of the VPN gateway connection:
// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol
// negotiations or rekeying processes.
// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway
// connection. Additionally, the peer is responsible for initiating the rekeying process
// after the connection is established. If rekeying does not occur, the VPN gateway
// connection will be brought down after its lifetime expires.
EstablishMode *string `json:"establish_mode" validate:"required"`
// The URL for this VPN gateway connection.
Href *string `json:"href" validate:"required"`
// The unique identifier for this VPN gateway connection.
ID *string `json:"id" validate:"required"`
// The IKE policy. If absent, [auto-negotiation is
// used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1).
IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"`
// The IPsec policy. If absent, [auto-negotiation is
// used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2).
IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"`
// The mode of the VPN gateway.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Mode *string `json:"mode" validate:"required"`
// The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway.
Name *string `json:"name" validate:"required"`
// The pre-shared 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"`
// The reasons for the current VPN gateway connection status (if any).
StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"`
// Indicates whether the traffic is distributed between the `up` tunnels of the VPN gateway connection when the VPC
// route's next hop is a VPN connection. If `false`, the traffic is only routed through the `up` tunnel with the lower
// `public_ip` address.
DistributeTraffic *bool `json:"distribute_traffic,omitempty"`
Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local,omitempty"`
Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer,omitempty"`
// The routing protocol 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"`
}
// Constants associated with the VPNGatewayConnection.AuthenticationMode property.
// The authentication mode.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
VPNGatewayConnectionAuthenticationModePskConst = "psk"
)
// Constants associated with the VPNGatewayConnection.EstablishMode property.
// The establish mode of the VPN gateway connection:
// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol
// negotiations or rekeying processes.
// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway
// connection. Additionally, the peer is responsible for initiating the rekeying process
// after the connection is established. If rekeying does not occur, the VPN gateway
// connection will be brought down after its lifetime expires.
const (
VPNGatewayConnectionEstablishModeBidirectionalConst = "bidirectional"
VPNGatewayConnectionEstablishModePeerOnlyConst = "peer_only"
)
// Constants associated with the VPNGatewayConnection.Mode property.
// The mode of the VPN gateway.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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.
// The routing protocol 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) {
// Retrieve discriminator value to determine correct "subclass".
var discValue string
err = core.UnmarshalPrimitive(m, "mode", &discValue)
if err != nil {
errMsg := fmt.Sprintf("error unmarshalling discriminator property 'mode': %s", err.Error())
err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo())
return
}
if discValue == "" {
err = core.SDKErrorf(err, "required discriminator property 'mode' not found in JSON object", "missing-discriminator", common.GetComponentInfo())
return
}
if discValue == "policy" {
err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionPolicyMode)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionPolicyMode-error", common.GetComponentInfo())
}
} else if discValue == "route" {
err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteMode)
if err != nil {
err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionRouteMode-error", common.GetComponentInfo())
}
} else {
errMsg := fmt.Sprintf("unrecognized value for discriminator property 'mode': %s", discValue)
err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo())
}
return
}
// VPNGatewayConnectionCIDRs : VPNGatewayConnectionCIDRs struct
type VPNGatewayConnectionCIDRs struct {
// The CIDRs for this resource.
CIDRs []string `json:"cidrs" validate:"required"`
}
// UnmarshalVPNGatewayConnectionCIDRs unmarshals an instance of VPNGatewayConnectionCIDRs from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionCIDRs(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionCIDRs)
err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs)
if err != nil {
err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayConnectionCollection : VPNGatewayConnectionCollection struct
type VPNGatewayConnectionCollection struct {
// A page of connections for the VPN gateway.
Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"`
// A link to the first page of resources.
First *PageLink `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 *PageLink `json:"next,omitempty"`
// The total number of resources across all pages.
TotalCount *int64 `json:"total_count" 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 {
err = core.SDKErrorf(err, "", "connections-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "limit", &obj.Limit)
if err != nil {
err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink)
if err != nil {
err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount)
if err != nil {
err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// Retrieve the value to be passed to a request to access the next page of results
func (resp *VPNGatewayConnectionCollection) GetNextStart() (*string, error) {
if core.IsNil(resp.Next) {
return nil, nil
}
start, err := core.GetQueryParam(resp.Next.Href, "start")
if err != nil {
err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo())
return nil, err
} else if start == nil {
return nil, nil
}
return start, nil
}
// VPNGatewayConnectionDpd : The dead peer detection configuration.
type VPNGatewayConnectionDpd struct {
// The dead peer detection action.
Action *string `json:"action" validate:"required"`
// The dead peer detection interval in seconds. Must not be greater than `timeout`.
Interval *int64 `json:"interval" validate:"required"`
// The dead peer detection timeout in seconds. Must not be less than `interval`.
Timeout *int64 `json:"timeout" validate:"required"`
}
// Constants associated with the VPNGatewayConnectionDpd.Action property.
// The dead peer detection action.
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 {
err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "interval", &obj.Interval)
if err != nil {
err = core.SDKErrorf(err, "", "interval-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout)
if err != nil {
err = core.SDKErrorf(err, "", "timeout-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayConnectionDpdPatch : The dead peer detection configuration.
type VPNGatewayConnectionDpdPatch struct {
// The dead peer detection action.
Action *string `json:"action,omitempty"`
// The dead peer detection interval in seconds. Must not be greater than `timeout`.
Interval *int64 `json:"interval,omitempty"`
// The dead peer detection timeout in seconds. Must not be less than `interval`.
Timeout *int64 `json:"timeout,omitempty"`
}
// Constants associated with the VPNGatewayConnectionDpdPatch.Action property.
// The dead peer detection action.
const (
VPNGatewayConnectionDpdPatchActionClearConst = "clear"
VPNGatewayConnectionDpdPatchActionHoldConst = "hold"
VPNGatewayConnectionDpdPatchActionNoneConst = "none"
VPNGatewayConnectionDpdPatchActionRestartConst = "restart"
)
// UnmarshalVPNGatewayConnectionDpdPatch unmarshals an instance of VPNGatewayConnectionDpdPatch from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionDpdPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionDpdPatch)
err = core.UnmarshalPrimitive(m, "action", &obj.Action)
if err != nil {
err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "interval", &obj.Interval)
if err != nil {
err = core.SDKErrorf(err, "", "interval-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout)
if err != nil {
err = core.SDKErrorf(err, "", "timeout-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the VPNGatewayConnectionDpdPatch
func (vpnGatewayConnectionDpdPatch *VPNGatewayConnectionDpdPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(vpnGatewayConnectionDpdPatch.Action) {
_patch["action"] = vpnGatewayConnectionDpdPatch.Action
}
if !core.IsNil(vpnGatewayConnectionDpdPatch.Interval) {
_patch["interval"] = vpnGatewayConnectionDpdPatch.Interval
}
if !core.IsNil(vpnGatewayConnectionDpdPatch.Timeout) {
_patch["timeout"] = vpnGatewayConnectionDpdPatch.Timeout
}
return
}
// VPNGatewayConnectionDpdPrototype : The dead peer detection configuration.
type VPNGatewayConnectionDpdPrototype struct {
// The dead peer detection action.
Action *string `json:"action,omitempty"`
// The dead peer detection interval in seconds. Must not be greater than `timeout`.
Interval *int64 `json:"interval,omitempty"`
// The dead peer detection timeout in seconds. Must not be less than `interval`.
Timeout *int64 `json:"timeout,omitempty"`
}
// Constants associated with the VPNGatewayConnectionDpdPrototype.Action property.
// The dead peer detection action.
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 {
err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "interval", &obj.Interval)
if err != nil {
err = core.SDKErrorf(err, "", "interval-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout)
if err != nil {
err = core.SDKErrorf(err, "", "timeout-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayConnectionIkeIdentity : VPNGatewayConnectionIkeIdentity struct
// Models which "extend" this model:
// - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn
// - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname
// - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4
// - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID
type VPNGatewayConnectionIkeIdentity struct {
// The IKE identity type.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Type *string `json:"type" validate:"required"`
// The IKE identity FQDN value.
Value *string `json:"value,omitempty"`
}
// Constants associated with the VPNGatewayConnectionIkeIdentity.Type property.
// The IKE identity type.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
VPNGatewayConnectionIkeIdentityTypeFqdnConst = "fqdn"
VPNGatewayConnectionIkeIdentityTypeHostnameConst = "hostname"
VPNGatewayConnectionIkeIdentityTypeIpv4AddressConst = "ipv4_address"
VPNGatewayConnectionIkeIdentityTypeKeyIDConst = "key_id"
)
func (*VPNGatewayConnectionIkeIdentity) isaVPNGatewayConnectionIkeIdentity() bool {
return true
}
type VPNGatewayConnectionIkeIdentityIntf interface {
isaVPNGatewayConnectionIkeIdentity() bool
}
// UnmarshalVPNGatewayConnectionIkeIdentity unmarshals an instance of VPNGatewayConnectionIkeIdentity from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionIkeIdentity(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionIkeIdentity)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayConnectionIkeIdentityPrototype : VPNGatewayConnectionIkeIdentityPrototype struct
// Models which "extend" this model:
// - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn
// - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname
// - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4
// - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID
type VPNGatewayConnectionIkeIdentityPrototype struct {
// The IKE identity type.
Type *string `json:"type" validate:"required"`
// The IKE identity FQDN value.
Value *string `json:"value,omitempty"`
}
// Constants associated with the VPNGatewayConnectionIkeIdentityPrototype.Type property.
// The IKE identity type.
const (
VPNGatewayConnectionIkeIdentityPrototypeTypeFqdnConst = "fqdn"
VPNGatewayConnectionIkeIdentityPrototypeTypeHostnameConst = "hostname"
VPNGatewayConnectionIkeIdentityPrototypeTypeIpv4AddressConst = "ipv4_address"
VPNGatewayConnectionIkeIdentityPrototypeTypeKeyIDConst = "key_id"
)
func (*VPNGatewayConnectionIkeIdentityPrototype) isaVPNGatewayConnectionIkeIdentityPrototype() bool {
return true
}
type VPNGatewayConnectionIkeIdentityPrototypeIntf interface {
isaVPNGatewayConnectionIkeIdentityPrototype() bool
}
// UnmarshalVPNGatewayConnectionIkeIdentityPrototype unmarshals an instance of VPNGatewayConnectionIkeIdentityPrototype from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionIkeIdentityPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionIkeIdentityPrototype)
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "value", &obj.Value)
if err != nil {
err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayConnectionIkePolicyPatch : The IKE policy to use. Specify `null` to remove any existing policy, [resulting in
// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1).
// Models which "extend" this model:
// - VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID
// - VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref
type VPNGatewayConnectionIkePolicyPatch struct {
// The unique identifier for this IKE policy.
ID *string `json:"id,omitempty"`
// The URL for this IKE policy.
Href *string `json:"href,omitempty"`
}
func (*VPNGatewayConnectionIkePolicyPatch) isaVPNGatewayConnectionIkePolicyPatch() bool {
return true
}
type VPNGatewayConnectionIkePolicyPatchIntf interface {
isaVPNGatewayConnectionIkePolicyPatch() bool
asPatch() map[string]interface{}
}
// UnmarshalVPNGatewayConnectionIkePolicyPatch unmarshals an instance of VPNGatewayConnectionIkePolicyPatch from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionIkePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionIkePolicyPatch)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the VPNGatewayConnectionIkePolicyPatch
func (vpnGatewayConnectionIkePolicyPatch *VPNGatewayConnectionIkePolicyPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(vpnGatewayConnectionIkePolicyPatch.ID) {
_patch["id"] = vpnGatewayConnectionIkePolicyPatch.ID
}
if !core.IsNil(vpnGatewayConnectionIkePolicyPatch.Href) {
_patch["href"] = vpnGatewayConnectionIkePolicyPatch.Href
}
return
}
// VPNGatewayConnectionIkePolicyPrototype : The IKE policy to use. If unspecified, [auto-negotiation will be
// used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1).
// Models which "extend" this model:
// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID
// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref
type VPNGatewayConnectionIkePolicyPrototype struct {
// The unique identifier for this IKE policy.
ID *string `json:"id,omitempty"`
// The URL for this IKE policy.
Href *string `json:"href,omitempty"`
}
func (*VPNGatewayConnectionIkePolicyPrototype) isaVPNGatewayConnectionIkePolicyPrototype() bool {
return true
}
type VPNGatewayConnectionIkePolicyPrototypeIntf interface {
isaVPNGatewayConnectionIkePolicyPrototype() bool
}
// UnmarshalVPNGatewayConnectionIkePolicyPrototype unmarshals an instance of VPNGatewayConnectionIkePolicyPrototype from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionIkePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionIkePolicyPrototype)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayConnectionIPsecPolicyPatch : The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in
// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2).
// Models which "extend" this model:
// - VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID
// - VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref
type VPNGatewayConnectionIPsecPolicyPatch struct {
// The unique identifier for this IPsec policy.
ID *string `json:"id,omitempty"`
// The URL for this IPsec policy.
Href *string `json:"href,omitempty"`
}
func (*VPNGatewayConnectionIPsecPolicyPatch) isaVPNGatewayConnectionIPsecPolicyPatch() bool {
return true
}
type VPNGatewayConnectionIPsecPolicyPatchIntf interface {
isaVPNGatewayConnectionIPsecPolicyPatch() bool
asPatch() map[string]interface{}
}
// UnmarshalVPNGatewayConnectionIPsecPolicyPatch unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatch from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionIPsecPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionIPsecPolicyPatch)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the VPNGatewayConnectionIPsecPolicyPatch
func (vpnGatewayConnectionIPsecPolicyPatch *VPNGatewayConnectionIPsecPolicyPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(vpnGatewayConnectionIPsecPolicyPatch.ID) {
_patch["id"] = vpnGatewayConnectionIPsecPolicyPatch.ID
}
if !core.IsNil(vpnGatewayConnectionIPsecPolicyPatch.Href) {
_patch["href"] = vpnGatewayConnectionIPsecPolicyPatch.Href
}
return
}
// VPNGatewayConnectionIPsecPolicyPrototype : The IPsec policy to use. If unspecified, [auto-negotiation will be
// used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2).
// Models which "extend" this model:
// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID
// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref
type VPNGatewayConnectionIPsecPolicyPrototype struct {
// The unique identifier for this IPsec policy.
ID *string `json:"id,omitempty"`
// The URL for this IPsec policy.
Href *string `json:"href,omitempty"`
}
func (*VPNGatewayConnectionIPsecPolicyPrototype) isaVPNGatewayConnectionIPsecPolicyPrototype() bool {
return true
}
type VPNGatewayConnectionIPsecPolicyPrototypeIntf interface {
isaVPNGatewayConnectionIPsecPolicyPrototype() bool
}
// UnmarshalVPNGatewayConnectionIPsecPolicyPrototype unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototype from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionIPsecPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionIPsecPolicyPrototype)
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayConnectionPatch : VPNGatewayConnectionPatch struct
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 configuration.
DeadPeerDetection *VPNGatewayConnectionDpdPatch `json:"dead_peer_detection,omitempty"`
// Indicates whether the traffic is distributed between the `up` tunnels of the VPN gateway connection when the VPC
// route's next hop is a VPN connection. If `false`, the traffic is only routed through the `up` tunnel with the lower
// `public_ip` address. Before enabling it on VPN connections to on-prem private networks, review
// [distributing traffic
// restrictions](https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-limitations#distributing-traffic-restrictions).
//
// If specified, `mode` must be `route`.
DistributeTraffic *bool `json:"distribute_traffic,omitempty"`
// The establish mode of the VPN gateway connection:
// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol
// negotiations or rekeying processes.
// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway
// connection. Additionally, the peer is responsible for initiating the rekeying process
// after the connection is established. If rekeying does not occur, the VPN gateway
// connection will be brought down after its lifetime expires.
EstablishMode *string `json:"establish_mode,omitempty"`
// The IKE policy to use. Specify `null` to remove any existing policy, [resulting in
// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1).
IkePolicy VPNGatewayConnectionIkePolicyPatchIntf `json:"ike_policy,omitempty"`
// The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in
// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2).
IpsecPolicy VPNGatewayConnectionIPsecPolicyPatchIntf `json:"ipsec_policy,omitempty"`
// The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway.
Name *string `json:"name,omitempty"`
Peer VPNGatewayConnectionPeerPatchIntf `json:"peer,omitempty"`
// The pre-shared key.
Psk *string `json:"psk,omitempty"`
}
// Constants associated with the VPNGatewayConnectionPatch.EstablishMode property.
// The establish mode of the VPN gateway connection:
// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol
// negotiations or rekeying processes.
// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway
// connection. Additionally, the peer is responsible for initiating the rekeying process
// after the connection is established. If rekeying does not occur, the VPN gateway
// connection will be brought down after its lifetime expires.
const (
VPNGatewayConnectionPatchEstablishModeBidirectionalConst = "bidirectional"
VPNGatewayConnectionPatchEstablishModePeerOnlyConst = "peer_only"
)
// 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 {
err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPatch)
if err != nil {
err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "distribute_traffic", &obj.DistributeTraffic)
if err != nil {
err = core.SDKErrorf(err, "", "distribute_traffic-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode)
if err != nil {
err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPatch)
if err != nil {
err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPatch)
if err != nil {
err = core.SDKErrorf(err, "", "ipsec_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionPeerPatch)
if err != nil {
err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "psk", &obj.Psk)
if err != nil {
err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo())
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) {
_patch = map[string]interface{}{}
if !core.IsNil(vpnGatewayConnectionPatch.AdminStateUp) {
_patch["admin_state_up"] = vpnGatewayConnectionPatch.AdminStateUp
}
if !core.IsNil(vpnGatewayConnectionPatch.DeadPeerDetection) {
_patch["dead_peer_detection"] = vpnGatewayConnectionPatch.DeadPeerDetection.asPatch()
}
if !core.IsNil(vpnGatewayConnectionPatch.DistributeTraffic) {
_patch["distribute_traffic"] = vpnGatewayConnectionPatch.DistributeTraffic
}
if !core.IsNil(vpnGatewayConnectionPatch.EstablishMode) {
_patch["establish_mode"] = vpnGatewayConnectionPatch.EstablishMode
}
if !core.IsNil(vpnGatewayConnectionPatch.IkePolicy) {
_patch["ike_policy"] = vpnGatewayConnectionPatch.IkePolicy.asPatch()
}
if !core.IsNil(vpnGatewayConnectionPatch.IpsecPolicy) {
_patch["ipsec_policy"] = vpnGatewayConnectionPatch.IpsecPolicy.asPatch()
}
if !core.IsNil(vpnGatewayConnectionPatch.Name) {
_patch["name"] = vpnGatewayConnectionPatch.Name
}
if !core.IsNil(vpnGatewayConnectionPatch.Peer) {
_patch["peer"] = vpnGatewayConnectionPatch.Peer.asPatch()
}
if !core.IsNil(vpnGatewayConnectionPatch.Psk) {
_patch["psk"] = vpnGatewayConnectionPatch.Psk
}
return
}
// VPNGatewayConnectionPeerPatch : VPNGatewayConnectionPeerPatch struct
// Models which "extend" this model:
// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch
// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch
type VPNGatewayConnectionPeerPatch struct {
// The IP address of the peer VPN gateway for this connection.
Address *string `json:"address,omitempty"`
// The FQDN of the peer VPN gateway for this connection.
Fqdn *string `json:"fqdn,omitempty"`
}
func (*VPNGatewayConnectionPeerPatch) isaVPNGatewayConnectionPeerPatch() bool {
return true
}
type VPNGatewayConnectionPeerPatchIntf interface {
isaVPNGatewayConnectionPeerPatch() bool
asPatch() map[string]interface{}
}
// UnmarshalVPNGatewayConnectionPeerPatch unmarshals an instance of VPNGatewayConnectionPeerPatch from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionPeerPatch(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionPeerPatch)
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn)
if err != nil {
err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// asPatch returns a generic map representation of the VPNGatewayConnectionPeerPatch
func (vpnGatewayConnectionPeerPatch *VPNGatewayConnectionPeerPatch) asPatch() (_patch map[string]interface{}) {
_patch = map[string]interface{}{}
if !core.IsNil(vpnGatewayConnectionPeerPatch.Address) {
_patch["address"] = vpnGatewayConnectionPeerPatch.Address
}
if !core.IsNil(vpnGatewayConnectionPeerPatch.Fqdn) {
_patch["fqdn"] = vpnGatewayConnectionPeerPatch.Fqdn
}
return
}
// VPNGatewayConnectionPolicyModeLocal : VPNGatewayConnectionPolicyModeLocal struct
type VPNGatewayConnectionPolicyModeLocal struct {
// The local CIDRs for this VPN gateway connection.
CIDRs []string `json:"cidrs" validate:"required"`
// The local IKE identities.
//
// A VPN gateway in policy mode consists of two members in active-standby mode. The local IKE identity applies to the
// active member.
IkeIdentities []VPNGatewayConnectionIkeIdentityIntf `json:"ike_identities" validate:"required"`
}
// UnmarshalVPNGatewayConnectionPolicyModeLocal unmarshals an instance of VPNGatewayConnectionPolicyModeLocal from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionPolicyModeLocal(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionPolicyModeLocal)
err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs)
if err != nil {
err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayConnectionPolicyModeLocalPrototype : VPNGatewayConnectionPolicyModeLocalPrototype struct
type VPNGatewayConnectionPolicyModeLocalPrototype struct {
// The local CIDRs for this VPN gateway connection.
CIDRs []string `json:"cidrs" validate:"required"`
// The local IKE identities to use.
//
// A VPN gateway in policy mode consists of two members in active-standby mode. The specified identity will be applied
// to the active member.
//
// If unspecified, then `type` will be `ipv4_address` and `value` will be the public IP address of the VPN gateway.
IkeIdentities []VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identities,omitempty"`
}
// NewVPNGatewayConnectionPolicyModeLocalPrototype : Instantiate VPNGatewayConnectionPolicyModeLocalPrototype (Generic Model Constructor)
func (*VpcV1) NewVPNGatewayConnectionPolicyModeLocalPrototype(cidrs []string) (_model *VPNGatewayConnectionPolicyModeLocalPrototype, err error) {
_model = &VPNGatewayConnectionPolicyModeLocalPrototype{
CIDRs: cidrs,
}
err = core.ValidateStruct(_model, "required parameters")
if err != nil {
err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo())
}
return
}
// UnmarshalVPNGatewayConnectionPolicyModeLocalPrototype unmarshals an instance of VPNGatewayConnectionPolicyModeLocalPrototype from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionPolicyModeLocalPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionPolicyModeLocalPrototype)
err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs)
if err != nil {
err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentityPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayConnectionPolicyModePeer : VPNGatewayConnectionPolicyModePeer struct
// Models which "extend" this model:
// - VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress
// - VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn
type VPNGatewayConnectionPolicyModePeer struct {
// The peer CIDRs for this VPN gateway connection.
CIDRs []string `json:"cidrs" validate:"required"`
// The peer IKE identity.
IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"`
// Indicates whether `peer.address` or `peer.fqdn` is used.
Type *string `json:"type" validate:"required"`
// The IP address of the peer VPN gateway for this connection.
Address *string `json:"address,omitempty"`
// The FQDN of the peer VPN gateway for this connection.
Fqdn *string `json:"fqdn,omitempty"`
}
// Constants associated with the VPNGatewayConnectionPolicyModePeer.Type property.
// Indicates whether `peer.address` or `peer.fqdn` is used.
const (
VPNGatewayConnectionPolicyModePeerTypeAddressConst = "address"
VPNGatewayConnectionPolicyModePeerTypeFqdnConst = "fqdn"
)
func (*VPNGatewayConnectionPolicyModePeer) isaVPNGatewayConnectionPolicyModePeer() bool {
return true
}
type VPNGatewayConnectionPolicyModePeerIntf interface {
isaVPNGatewayConnectionPolicyModePeer() bool
}
// UnmarshalVPNGatewayConnectionPolicyModePeer unmarshals an instance of VPNGatewayConnectionPolicyModePeer from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionPolicyModePeer(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionPolicyModePeer)
err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs)
if err != nil {
err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn)
if err != nil {
err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayConnectionPolicyModePeerPrototype : VPNGatewayConnectionPolicyModePeerPrototype struct
// Models which "extend" this model:
// - VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress
// - VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn
type VPNGatewayConnectionPolicyModePeerPrototype struct {
// The peer CIDRs for this VPN gateway connection.
CIDRs []string `json:"cidrs" validate:"required"`
// The peer IKE identity to use.
//
// If unspecified:
// - If `peer.address` is specified, the `type` will be `ipv4_address`, and
// the `value` will be `peer.address`.
// - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value`
// will be `peer.fqdn`.
IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"`
// The IP address of the peer VPN gateway for this connection.
Address *string `json:"address,omitempty"`
// The FQDN of the peer VPN gateway for this connection.
Fqdn *string `json:"fqdn,omitempty"`
}
func (*VPNGatewayConnectionPolicyModePeerPrototype) isaVPNGatewayConnectionPolicyModePeerPrototype() bool {
return true
}
type VPNGatewayConnectionPolicyModePeerPrototypeIntf interface {
isaVPNGatewayConnectionPolicyModePeerPrototype() bool
}
// UnmarshalVPNGatewayConnectionPolicyModePeerPrototype unmarshals an instance of VPNGatewayConnectionPolicyModePeerPrototype from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionPolicyModePeerPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionPolicyModePeerPrototype)
err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs)
if err != nil {
err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn)
if err != nil {
err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo())
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 configuration.
DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"`
// The establish mode of the VPN gateway connection:
// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol
// negotiations or rekeying processes.
// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway
// connection. Additionally, the peer is responsible for initiating the rekeying process
// after the connection is established. If rekeying does not occur, the VPN gateway
// connection will be brought down after its lifetime expires.
EstablishMode *string `json:"establish_mode,omitempty"`
// The IKE policy to use. If unspecified, [auto-negotiation will be
// used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1).
IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"`
// The IPsec policy to use. If unspecified, [auto-negotiation will be
// used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2).
IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"`
// The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If
// unspecified, the name will be a hyphenated list of randomly-selected words.
Name *string `json:"name,omitempty"`
// The pre-shared key.
Psk *string `json:"psk" validate:"required"`
// Indicates whether the traffic is distributed between the `up` tunnels of the VPN gateway connection when the VPC
// route's next hop is a VPN connection. If `false`, the traffic is only routed through the `up` tunnel with the lower
// `public_ip` address. Before enabling it on VPN connections to on-prem private networks, review
// [distributing traffic
// restrictions](https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-limitations#distributing-traffic-restrictions).
DistributeTraffic *bool `json:"distribute_traffic,omitempty"`
Local *VPNGatewayConnectionStaticRouteModeLocalPrototype `json:"local,omitempty"`
Peer VPNGatewayConnectionStaticRouteModePeerPrototypeIntf `json:"peer,omitempty"`
// The routing protocol for this VPN gateway connection.
RoutingProtocol *string `json:"routing_protocol,omitempty"`
}
// Constants associated with the VPNGatewayConnectionPrototype.EstablishMode property.
// The establish mode of the VPN gateway connection:
// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol
// negotiations or rekeying processes.
// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway
// connection. Additionally, the peer is responsible for initiating the rekeying process
// after the connection is established. If rekeying does not occur, the VPN gateway
// connection will be brought down after its lifetime expires.
const (
VPNGatewayConnectionPrototypeEstablishModeBidirectionalConst = "bidirectional"
VPNGatewayConnectionPrototypeEstablishModePeerOnlyConst = "peer_only"
)
// Constants associated with the VPNGatewayConnectionPrototype.RoutingProtocol property.
// The routing protocol 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 {
err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode)
if err != nil {
err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "ipsec_policy-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "psk", &obj.Psk)
if err != nil {
err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "distribute_traffic", &obj.DistributeTraffic)
if err != nil {
err = core.SDKErrorf(err, "", "distribute_traffic-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol)
if err != nil {
err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo())
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 *Deleted `json:"deleted,omitempty"`
// The URL for this VPN gateway connection.
Href *string `json:"href" validate:"required"`
// The unique identifier for this VPN gateway connection.
ID *string `json:"id" validate:"required"`
// The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway.
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, UnmarshalDeleted)
if err != nil {
err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "href", &obj.Href)
if err != nil {
err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "id", &obj.ID)
if err != nil {
err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "name", &obj.Name)
if err != nil {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType)
if err != nil {
err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayConnectionStaticRouteModeLocal : VPNGatewayConnectionStaticRouteModeLocal struct
type VPNGatewayConnectionStaticRouteModeLocal struct {
// The local IKE identities.
//
// A VPN gateway in static route mode consists of two members in active-active mode. The first identity applies to the
// first member, and the second identity applies to the second member.
IkeIdentities []VPNGatewayConnectionIkeIdentityIntf `json:"ike_identities" validate:"required"`
}
// UnmarshalVPNGatewayConnectionStaticRouteModeLocal unmarshals an instance of VPNGatewayConnectionStaticRouteModeLocal from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionStaticRouteModeLocal(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionStaticRouteModeLocal)
err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayConnectionStaticRouteModeLocalPrototype : VPNGatewayConnectionStaticRouteModeLocalPrototype struct
type VPNGatewayConnectionStaticRouteModeLocalPrototype struct {
// The local IKE identities to use.
//
// A VPN gateway in static route mode consists of two members in active-active mode. The first specified identity will
// be applied to the first member, and the second specified identity will be applied to the second member.
//
// If unspecified, then `type` will be `ipv4_address` and `value` will be the public IP address of the member's VPN
// connection tunnel.
IkeIdentities []VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identities,omitempty"`
}
// UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype unmarshals an instance of VPNGatewayConnectionStaticRouteModeLocalPrototype from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionStaticRouteModeLocalPrototype)
err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentityPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayConnectionStaticRouteModePeer : VPNGatewayConnectionStaticRouteModePeer struct
// Models which "extend" this model:
// - VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress
// - VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn
type VPNGatewayConnectionStaticRouteModePeer struct {
// The peer IKE identity.
IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"`
// Indicates whether `peer.address` or `peer.fqdn` is used.
Type *string `json:"type" validate:"required"`
// The IP address of the peer VPN gateway for this connection.
Address *string `json:"address,omitempty"`
// The FQDN of the peer VPN gateway for this connection.
Fqdn *string `json:"fqdn,omitempty"`
}
// Constants associated with the VPNGatewayConnectionStaticRouteModePeer.Type property.
// Indicates whether `peer.address` or `peer.fqdn` is used.
const (
VPNGatewayConnectionStaticRouteModePeerTypeAddressConst = "address"
VPNGatewayConnectionStaticRouteModePeerTypeFqdnConst = "fqdn"
)
func (*VPNGatewayConnectionStaticRouteModePeer) isaVPNGatewayConnectionStaticRouteModePeer() bool {
return true
}
type VPNGatewayConnectionStaticRouteModePeerIntf interface {
isaVPNGatewayConnectionStaticRouteModePeer() bool
}
// UnmarshalVPNGatewayConnectionStaticRouteModePeer unmarshals an instance of VPNGatewayConnectionStaticRouteModePeer from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionStaticRouteModePeer(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionStaticRouteModePeer)
err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity)
if err != nil {
err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "type", &obj.Type)
if err != nil {
err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn)
if err != nil {
err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayConnectionStaticRouteModePeerPrototype : VPNGatewayConnectionStaticRouteModePeerPrototype struct
// Models which "extend" this model:
// - VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress
// - VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn
type VPNGatewayConnectionStaticRouteModePeerPrototype struct {
// The peer IKE identity to use.
//
// If unspecified:
// - If `peer.address` is specified, the `type` will be `ipv4_address`, and
// the `value` will be `peer.address`.
// - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value`
// will be `peer.fqdn`.
IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"`
// The IP address of the peer VPN gateway for this connection.
Address *string `json:"address,omitempty"`
// The FQDN of the peer VPN gateway for this connection.
Fqdn *string `json:"fqdn,omitempty"`
}
func (*VPNGatewayConnectionStaticRouteModePeerPrototype) isaVPNGatewayConnectionStaticRouteModePeerPrototype() bool {
return true
}
type VPNGatewayConnectionStaticRouteModePeerPrototypeIntf interface {
isaVPNGatewayConnectionStaticRouteModePeerPrototype() bool
}
// UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype unmarshals an instance of VPNGatewayConnectionStaticRouteModePeerPrototype from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionStaticRouteModePeerPrototype)
err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype)
if err != nil {
err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "address", &obj.Address)
if err != nil {
err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn)
if err != nil {
err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo())
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.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Status *string `json:"status" validate:"required"`
// The reasons for the current status (if any).
StatusReasons []VPNGatewayConnectionTunnelStatusReason `json:"status_reasons" validate:"required"`
}
// Constants associated with the VPNGatewayConnectionStaticRouteModeTunnel.Status property.
// The status of the VPN Tunnel.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
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 {
err = core.SDKErrorf(err, "", "public_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "status", &obj.Status)
if err != nil {
err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionTunnelStatusReason)
if err != nil {
err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayConnectionStatusReason : VPNGatewayConnectionStatusReason struct
type VPNGatewayConnectionStatusReason struct {
// A snake case string succinctly identifying the status reason.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this VPN gateway connection's status.
Message *string `json:"message" validate:"required"`
// A link to documentation about this status reason.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the VPNGatewayConnectionStatusReason.Code property.
// A snake case string succinctly identifying the status reason.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
VPNGatewayConnectionStatusReasonCodeCannotAuthenticateConnectionConst = "cannot_authenticate_connection"
VPNGatewayConnectionStatusReasonCodeIkePolicyMismatchConst = "ike_policy_mismatch"
VPNGatewayConnectionStatusReasonCodeIkeV1IDLocalRemoteCIDRMismatchConst = "ike_v1_id_local_remote_cidr_mismatch"
VPNGatewayConnectionStatusReasonCodeIkeV2LocalRemoteCIDRMismatchConst = "ike_v2_local_remote_cidr_mismatch"
VPNGatewayConnectionStatusReasonCodeInternalErrorConst = "internal_error"
VPNGatewayConnectionStatusReasonCodeIpsecPolicyMismatchConst = "ipsec_policy_mismatch"
VPNGatewayConnectionStatusReasonCodePeerNotRespondingConst = "peer_not_responding"
)
// UnmarshalVPNGatewayConnectionStatusReason unmarshals an instance of VPNGatewayConnectionStatusReason from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionStatusReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionStatusReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayConnectionTunnelStatusReason : VPNGatewayConnectionTunnelStatusReason struct
type VPNGatewayConnectionTunnelStatusReason struct {
// A reason code for this status:
// - `cannot_authenticate_connection`: Failed to authenticate a connection because of
// mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration)
// - `internal_error`: Internal error (contact IBM support)
// - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check
// the IKE policies on both sides of the VPN)
// - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and
// remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE
// V1 configuration)
// - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE
// V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration)
// - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable
// (check the IPsec policies on both sides of the VPN)
// - `peer_not_responding`: No response from peer (check network ACL configuration, peer
// availability, and on-premise firewall configuration)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this VPN gateway connection tunnel's status.
Message *string `json:"message" validate:"required"`
// A link to documentation about this status reason.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the VPNGatewayConnectionTunnelStatusReason.Code property.
// A reason code for this status:
// - `cannot_authenticate_connection`: Failed to authenticate a connection because of
// mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration)
// - `internal_error`: Internal error (contact IBM support)
// - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check
// the IKE policies on both sides of the VPN)
// - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and
// remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE
// V1 configuration)
// - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE
// V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration)
// - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable
// (check the IPsec policies on both sides of the VPN)
// - `peer_not_responding`: No response from peer (check network ACL configuration, peer
// availability, and on-premise firewall configuration)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
VPNGatewayConnectionTunnelStatusReasonCodeCannotAuthenticateConnectionConst = "cannot_authenticate_connection"
VPNGatewayConnectionTunnelStatusReasonCodeIkePolicyMismatchConst = "ike_policy_mismatch"
VPNGatewayConnectionTunnelStatusReasonCodeIkeV1IDLocalRemoteCIDRMismatchConst = "ike_v1_id_local_remote_cidr_mismatch"
VPNGatewayConnectionTunnelStatusReasonCodeIkeV2LocalRemoteCIDRMismatchConst = "ike_v2_local_remote_cidr_mismatch"
VPNGatewayConnectionTunnelStatusReasonCodeInternalErrorConst = "internal_error"
VPNGatewayConnectionTunnelStatusReasonCodeIpsecPolicyMismatchConst = "ipsec_policy_mismatch"
VPNGatewayConnectionTunnelStatusReasonCodePeerNotRespondingConst = "peer_not_responding"
)
// UnmarshalVPNGatewayConnectionTunnelStatusReason unmarshals an instance of VPNGatewayConnectionTunnelStatusReason from the specified map of raw messages.
func UnmarshalVPNGatewayConnectionTunnelStatusReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayConnectionTunnelStatusReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayHealthReason : VPNGatewayHealthReason struct
type VPNGatewayHealthReason struct {
// A reason code for this health state:
// - `cannot_create_vpc_route`: VPN cannot create route (check for conflict)
// - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's
// subnet)
// - `internal_error`: Internal error (contact IBM support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this health state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this health state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the VPNGatewayHealthReason.Code property.
// A reason code for this health state:
// - `cannot_create_vpc_route`: VPN cannot create route (check for conflict)
// - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's
// subnet)
// - `internal_error`: Internal error (contact IBM support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
VPNGatewayHealthReasonCodeCannotCreateVPCRouteConst = "cannot_create_vpc_route"
VPNGatewayHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address"
VPNGatewayHealthReasonCodeInternalErrorConst = "internal_error"
)
// UnmarshalVPNGatewayHealthReason unmarshals an instance of VPNGatewayHealthReason from the specified map of raw messages.
func UnmarshalVPNGatewayHealthReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayHealthReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayLifecycleReason : VPNGatewayLifecycleReason struct
type VPNGatewayLifecycleReason struct {
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this lifecycle state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this lifecycle state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the VPNGatewayLifecycleReason.Code property.
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
VPNGatewayLifecycleReasonCodeInternalErrorConst = "internal_error"
VPNGatewayLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider"
)
// UnmarshalVPNGatewayLifecycleReason unmarshals an instance of VPNGatewayLifecycleReason from the specified map of raw messages.
func UnmarshalVPNGatewayLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayLifecycleReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayMember : VPNGatewayMember struct
type VPNGatewayMember struct {
// The reasons for the current `health_state` (if any).
HealthReasons []VPNGatewayMemberHealthReason `json:"health_reasons" validate:"required"`
// The health of this resource:
// - `ok`: No abnormal behavior detected
// - `degraded`: Experiencing 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 reasons for the current `lifecycle_state` (if any).
LifecycleReasons []VPNGatewayMemberLifecycleReason `json:"lifecycle_reasons" validate:"required"`
// The lifecycle state of the VPN gateway member.
LifecycleState *string `json:"lifecycle_state" validate:"required"`
// The reserved IP address assigned to the VPN gateway member.
//
// This property will be present only when the VPN gateway status is `available`.
PrivateIP *ReservedIPReference `json:"private_ip" validate:"required"`
// 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.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Role *string `json:"role" validate:"required"`
}
// Constants associated with the VPNGatewayMember.HealthState property.
// The health of this resource:
// - `ok`: No abnormal behavior detected
// - `degraded`: Experiencing 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 (
VPNGatewayMemberHealthStateDegradedConst = "degraded"
VPNGatewayMemberHealthStateFaultedConst = "faulted"
VPNGatewayMemberHealthStateInapplicableConst = "inapplicable"
VPNGatewayMemberHealthStateOkConst = "ok"
)
// Constants associated with the VPNGatewayMember.LifecycleState property.
// The lifecycle state of the VPN gateway member.
const (
VPNGatewayMemberLifecycleStateDeletingConst = "deleting"
VPNGatewayMemberLifecycleStateFailedConst = "failed"
VPNGatewayMemberLifecycleStatePendingConst = "pending"
VPNGatewayMemberLifecycleStateStableConst = "stable"
VPNGatewayMemberLifecycleStateSuspendedConst = "suspended"
VPNGatewayMemberLifecycleStateUpdatingConst = "updating"
VPNGatewayMemberLifecycleStateWaitingConst = "waiting"
)
// Constants associated with the VPNGatewayMember.Role property.
// The high availability role assigned to the VPN gateway member.
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
VPNGatewayMemberRoleActiveConst = "active"
VPNGatewayMemberRoleStandbyConst = "standby"
)
// 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, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayMemberHealthReason)
if err != nil {
err = core.SDKErrorf(err, "", "health_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState)
if err != nil {
err = core.SDKErrorf(err, "", "health_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayMemberLifecycleReason)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState)
if err != nil {
err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "private_ip", &obj.PrivateIP, UnmarshalReservedIPReference)
if err != nil {
err = core.SDKErrorf(err, "", "private_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP)
if err != nil {
err = core.SDKErrorf(err, "", "public_ip-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "role", &obj.Role)
if err != nil {
err = core.SDKErrorf(err, "", "role-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayMemberHealthReason : VPNGatewayMemberHealthReason struct
type VPNGatewayMemberHealthReason struct {
// A reason code for this health state:
// - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's
// subnet)
// - `internal_error`: Internal error (contact IBM support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this health state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this health state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the VPNGatewayMemberHealthReason.Code property.
// A reason code for this health state:
// - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's
// subnet)
// - `internal_error`: Internal error (contact IBM support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
VPNGatewayMemberHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address"
VPNGatewayMemberHealthReasonCodeInternalErrorConst = "internal_error"
)
// UnmarshalVPNGatewayMemberHealthReason unmarshals an instance of VPNGatewayMemberHealthReason from the specified map of raw messages.
func UnmarshalVPNGatewayMemberHealthReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayMemberHealthReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayMemberLifecycleReason : VPNGatewayMemberLifecycleReason struct
type VPNGatewayMemberLifecycleReason struct {
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
Code *string `json:"code" validate:"required"`
// An explanation of the reason for this lifecycle state.
Message *string `json:"message" validate:"required"`
// A link to documentation about the reason for this lifecycle state.
MoreInfo *string `json:"more_info,omitempty"`
}
// Constants associated with the VPNGatewayMemberLifecycleReason.Code property.
// A reason code for this lifecycle state:
// - `internal_error`: internal error (contact IBM support)
// - `resource_suspended_by_provider`: The resource has been suspended (contact IBM
// support)
//
// The enumerated values for this property may
// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.
const (
VPNGatewayMemberLifecycleReasonCodeInternalErrorConst = "internal_error"
VPNGatewayMemberLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider"
)
// UnmarshalVPNGatewayMemberLifecycleReason unmarshals an instance of VPNGatewayMemberLifecycleReason from the specified map of raw messages.
func UnmarshalVPNGatewayMemberLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(VPNGatewayMemberLifecycleReason)
err = core.UnmarshalPrimitive(m, "code", &obj.Code)
if err != nil {
err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo())
return
}
err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo)
if err != nil {
err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// VPNGatewayPatch : VPNGatewayPatch struct
type VPNGatewayPatch struct {
// The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC.
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 {
err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo())
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
// AsPatch returns a generic map representation of the VPNGatewayPatch
func (vpnGatewayPatch *VPNGatewayPatch) As