From bbdfd1ad4ad92ada36af7c1885785b14a8909ba6 Mon Sep 17 00:00:00 2001 From: SunithaGudisagar Date: Mon, 16 Oct 2023 20:07:01 +0530 Subject: [PATCH] feat(ebaas): Enterprise BaaS --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 510 +++++++++++++----- examples/ibm-is-ng/main.tf | 14 + ibm/acctest/acctest.go | 6 + .../vpc/data_source_ibm_is_backup_policies.go | 101 ++++ .../vpc/data_source_ibm_is_backup_policy.go | 102 ++++ .../data_source_ibm_is_bare_metal_servers.go | 24 +- .../data_source_ibm_is_share_mount_target.go | 16 - .../vpc/resource_ibm_is_backup_policy.go | 105 ++++ .../vpc/resource_ibm_is_backup_policy_test.go | 45 ++ .../docs/d/is_backup_policies.html.markdown | 15 +- website/docs/d/is_backup_policy.html.markdown | 14 + website/docs/d/is_bare_metal_servers.markdown | 3 - website/docs/r/is_backup_policy.html.markdown | 27 + 13 files changed, 807 insertions(+), 175 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 31a36972c6..5a73bc91a0 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2021, 2022, 2023. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ import ( // VpcV1 : The IBM Cloud Virtual Private Cloud (VPC) API can be used to programmatically provision and manage virtual // server instances, along with subnets, volumes, load balancers, and more. // -// API Version: 2022-09-20 +// API Version: 2022-09-13 type VpcV1 struct { Service *core.BaseService @@ -47,7 +47,7 @@ type VpcV1 struct { generation *int64 // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-09-20`. + // and `2023-10-04`. Version *string } @@ -64,7 +64,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-09-20`. + // and `2023-10-04`. Version *string } @@ -6691,8 +6691,8 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C return } -// ListInstanceNetworkInterfaceIps : List all reserved IPs bound to an instance network interface -// This request lists all reserved IPs bound to an instance network interface. +// ListInstanceNetworkInterfaceIps : List the primary reserved IP for an instance network interface +// This request lists the primary reserved IP for an instance network interface. func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { return vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) } @@ -6761,9 +6761,8 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context return } -// GetInstanceNetworkInterfaceIP : Retrieve bound reserved IP -// This request retrieves the specified reserved IP address if it is bound to the network interface and instance -// specified in the URL. +// GetInstanceNetworkInterfaceIP : Retrieve the primary reserved IP +// This request retrieves the primary reserved IP for an instance network interface. func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { return vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) } @@ -9951,6 +9950,9 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku if createBackupPolicyOptions.ResourceGroup != nil { body["resource_group"] = createBackupPolicyOptions.ResourceGroup } + if createBackupPolicyOptions.Scope != nil { + body["scope"] = createBackupPolicyOptions.Scope + } _, err = builder.SetBodyContentJSON(body) if err != nil { return @@ -11212,15 +11214,6 @@ func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareM if listBareMetalServersOptions.VPCName != nil { builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) } - if listBareMetalServersOptions.NetworkInterfacesSubnetID != nil { - builder.AddQuery("network_interfaces.subnet.id", fmt.Sprint(*listBareMetalServersOptions.NetworkInterfacesSubnetID)) - } - if listBareMetalServersOptions.NetworkInterfacesSubnetCRN != nil { - builder.AddQuery("network_interfaces.subnet.crn", fmt.Sprint(*listBareMetalServersOptions.NetworkInterfacesSubnetCRN)) - } - if listBareMetalServersOptions.NetworkInterfacesSubnetName != nil { - builder.AddQuery("network_interfaces.subnet.name", fmt.Sprint(*listBareMetalServersOptions.NetworkInterfacesSubnetName)) - } request, err := builder.Build() if err != nil { @@ -12205,8 +12198,8 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co return } -// ListBareMetalServerNetworkInterfaceIps : List all reserved IPs bound to a bare metal server network interface -// This request lists all reserved IPs bound to a bare metal server network interface. +// 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. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { return vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) } @@ -12269,9 +12262,8 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. return } -// GetBareMetalServerNetworkInterfaceIP : Retrieve bound reserved IP -// This request retrieves the specified reserved IP address if it is bound to the network interface for the bare metal -// server specified in the URL. +// GetBareMetalServerNetworkInterfaceIP : Retrieve the primary reserved IP +// This request retrieves the primary reserved IP for a bare metal server network interface. func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { return vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) } @@ -24265,6 +24257,22 @@ type BackupPolicy struct { // The CRN for this backup policy. CRN *string `json:"crn" validate:"required"` + // The reasons for the current `health_state` (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + 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"` @@ -24302,8 +24310,26 @@ type BackupPolicy struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` + + // The scope for this backup policy. + Scope BackupPolicyScopeIntf `json:"scope" validate:"required"` } +// 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 ( @@ -24339,6 +24365,14 @@ func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalBackupPolicyHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -24379,6 +24413,10 @@ func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } + err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScope) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -24475,6 +24513,43 @@ func UnmarshalBackupPolicyCollectionNext(m map[string]json.RawMessage, result in return } +// BackupPolicyHealthReason : BackupPolicyHealthReason struct +type BackupPolicyHealthReason struct { + // A snake case string succinctly identifying the reason 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"` + + // Link to documentation about the reason for this health state. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the BackupPolicyHealthReason.Code property. +// A snake case string succinctly identifying the reason 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 { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BackupPolicyJob : BackupPolicyJob struct type BackupPolicyJob struct { // Indicates whether this backup policy job will be automatically deleted after it completes. At present, this is @@ -25497,6 +25572,83 @@ func UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype(m map[string]json.RawM 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 { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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 { + 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 interfaces. @@ -28468,9 +28620,14 @@ type CreateBackupPolicyOptions struct { 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) is used. + // 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"` + // Allows users to set headers on API requests Headers map[string]string } @@ -28518,6 +28675,12 @@ func (_options *CreateBackupPolicyOptions) SetResourceGroup(resourceGroup Resour return _options } +// SetScope : Allow user to set Scope +func (_options *CreateBackupPolicyOptions) SetScope(scope BackupPolicyScopePrototypeIntf) *CreateBackupPolicyOptions { + _options.Scope = scope + return _options +} + // SetHeaders : Allow user to set Headers func (options *CreateBackupPolicyOptions) SetHeaders(param map[string]string) *CreateBackupPolicyOptions { options.Headers = param @@ -28753,7 +28916,7 @@ type CreateBareMetalServerOptions struct { NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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"` @@ -28860,7 +29023,7 @@ type CreateDedicatedHostGroupOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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 @@ -28972,7 +29135,7 @@ type CreateEndpointGatewayOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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. @@ -29087,7 +29250,7 @@ type CreateFlowLogCollectorOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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 @@ -29160,7 +29323,7 @@ type CreateIkePolicyOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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 @@ -29624,7 +29787,7 @@ type CreateInstanceGroupOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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 @@ -29913,7 +30076,7 @@ type CreateIpsecPolicyOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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 @@ -30031,7 +30194,7 @@ type CreateKeyOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The crypto-system used by this key. @@ -30544,7 +30707,7 @@ type CreateLoadBalancerOptions struct { 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) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // Indicates whether route mode is enabled for this load balancer. @@ -30942,7 +31105,7 @@ type CreatePlacementGroupOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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 @@ -31008,7 +31171,7 @@ type CreatePublicGatewayOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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 @@ -31069,7 +31232,7 @@ type CreateSecurityGroupOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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, @@ -31611,7 +31774,7 @@ type CreateVPCOptions struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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 @@ -32152,7 +32315,7 @@ type CreateVPNServerOptions struct { 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) is used. + // 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. @@ -34110,7 +34273,7 @@ type DedicatedHostPrototype struct { Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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. @@ -37581,7 +37744,7 @@ type FloatingIPPrototype struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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. @@ -42798,7 +42961,7 @@ type ImagePrototype struct { 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) is used. + // 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. @@ -47724,7 +47887,7 @@ type InstancePrototype struct { Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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 @@ -48384,7 +48547,7 @@ type InstanceTemplatePrototype struct { Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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 @@ -49426,18 +49589,6 @@ type ListBareMetalServersOptions struct { // 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 bare metal servers with an item in the `network_interfaces` property with a `subnet.id` - // property matching the specified identifier. - NetworkInterfacesSubnetID *string `json:"network_interfaces.subnet.id,omitempty"` - - // Filters the collection to bare metal servers with an item in the `network_interfaces` property with a `subnet.crn` - // property matching the specified CRN. - NetworkInterfacesSubnetCRN *string `json:"network_interfaces.subnet.crn,omitempty"` - - // Filters the collection to bare metal servers with an item in the `network_interfaces` property with a `subnet.name` - // property matching the exact specified name. - NetworkInterfacesSubnetName *string `json:"network_interfaces.subnet.name,omitempty"` - // Allows users to set headers on API requests Headers map[string]string } @@ -49489,24 +49640,6 @@ func (_options *ListBareMetalServersOptions) SetVPCName(vpcName string) *ListBar return _options } -// SetNetworkInterfacesSubnetID : Allow user to set NetworkInterfacesSubnetID -func (_options *ListBareMetalServersOptions) SetNetworkInterfacesSubnetID(networkInterfacesSubnetID string) *ListBareMetalServersOptions { - _options.NetworkInterfacesSubnetID = core.StringPtr(networkInterfacesSubnetID) - return _options -} - -// SetNetworkInterfacesSubnetCRN : Allow user to set NetworkInterfacesSubnetCRN -func (_options *ListBareMetalServersOptions) SetNetworkInterfacesSubnetCRN(networkInterfacesSubnetCRN string) *ListBareMetalServersOptions { - _options.NetworkInterfacesSubnetCRN = core.StringPtr(networkInterfacesSubnetCRN) - return _options -} - -// SetNetworkInterfacesSubnetName : Allow user to set NetworkInterfacesSubnetName -func (_options *ListBareMetalServersOptions) SetNetworkInterfacesSubnetName(networkInterfacesSubnetName string) *ListBareMetalServersOptions { - _options.NetworkInterfacesSubnetName = core.StringPtr(networkInterfacesSubnetName) - return _options -} - // SetHeaders : Allow user to set Headers func (options *ListBareMetalServersOptions) SetHeaders(param map[string]string) *ListBareMetalServersOptions { options.Headers = param @@ -57355,7 +57488,7 @@ type NetworkACLPrototype struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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. @@ -59554,7 +59687,7 @@ type PublicGatewayFloatingIPPrototype struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` } @@ -60970,7 +61103,7 @@ func UnmarshalResourceFilter(m map[string]json.RawMessage, result interface{}) ( } // ResourceGroupIdentity : The resource group to use. If unspecified, the account's [default resource -// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. +// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. // Models which "extend" this model: // - ResourceGroupIdentityByID type ResourceGroupIdentity struct { @@ -64525,16 +64658,15 @@ type ShareMountTargetVirtualNetworkInterfacePrototype struct { // an available address on the subnet will be automatically selected and reserved. PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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 and - // `primary_ip.address` is not specified. + // The associated subnet. Required if `primary_ip` does not specify a reserved IP. Subnet SubnetIdentityIntf `json:"subnet,omitempty"` } @@ -65114,7 +65246,7 @@ type SharePrototype struct { InitialOwner *ShareInitialOwner `json:"initial_owner,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The size of the file share rounded up to the next gigabyte. @@ -65961,7 +66093,7 @@ type SnapshotPrototype struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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. @@ -66636,7 +66768,7 @@ type SubnetPrototype struct { PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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 @@ -71820,7 +71952,7 @@ type VPNGatewayPrototype struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // Identifies a subnet by a unique property. @@ -73246,10 +73378,6 @@ type VirtualNetworkInterfaceReferenceAttachmentContext struct { // The CRN for this virtual network interface. CRN *string `json:"crn" validate:"required"` - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VirtualNetworkInterfaceReferenceAttachmentContextDeleted `json:"deleted,omitempty"` - // The URL for this virtual network interface. Href *string `json:"href" validate:"required"` @@ -73276,10 +73404,6 @@ func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]jso if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContextDeleted) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -73300,24 +73424,6 @@ func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]jso return } -// VirtualNetworkInterfaceReferenceAttachmentContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VirtualNetworkInterfaceReferenceAttachmentContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVirtualNetworkInterfaceReferenceAttachmentContextDeleted unmarshals an instance of VirtualNetworkInterfaceReferenceAttachmentContextDeleted from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceReferenceAttachmentContextDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VirtualNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary // information. type VirtualNetworkInterfaceReferenceDeleted struct { @@ -73336,24 +73442,6 @@ func UnmarshalVirtualNetworkInterfaceReferenceDeleted(m map[string]json.RawMessa return } -// VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted unmarshals an instance of VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VirtualNetworkInterfaceTarget : A virtual network interface target. // // The resource types that can be virtual network interface targets are expected to expand in the future. When iterating @@ -74753,7 +74841,7 @@ type VolumePrototype struct { Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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 volume. @@ -75434,6 +75522,116 @@ func UnmarshalBackupPolicyJobSourceVolumeReference(m map[string]json.RawMessage, return } +// BackupPolicyScopePrototypeEnterpriseIdentity : Identifies an enterprise by a unique property. +// Models which "extend" this model: +// - BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN +// This model "extends" BackupPolicyScopePrototype +type BackupPolicyScopePrototypeEnterpriseIdentity struct { + // The CRN for this enterprise. + CRN *string `json:"crn,omitempty"` +} + +func (*BackupPolicyScopePrototypeEnterpriseIdentity) isaBackupPolicyScopePrototypeEnterpriseIdentity() bool { + return true +} + +type BackupPolicyScopePrototypeEnterpriseIdentityIntf interface { + BackupPolicyScopePrototypeIntf + isaBackupPolicyScopePrototypeEnterpriseIdentity() bool +} + +func (*BackupPolicyScopePrototypeEnterpriseIdentity) isaBackupPolicyScopePrototype() bool { + return true +} + +// UnmarshalBackupPolicyScopePrototypeEnterpriseIdentity unmarshals an instance of BackupPolicyScopePrototypeEnterpriseIdentity from the specified map of raw messages. +func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopePrototypeEnterpriseIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyScopeAccountReference : BackupPolicyScopeAccountReference struct +// This model "extends" BackupPolicyScope +type BackupPolicyScopeAccountReference 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 BackupPolicyScopeAccountReference.ResourceType property. +// The resource type. +const ( + BackupPolicyScopeAccountReferenceResourceTypeAccountConst = "account" +) + +func (*BackupPolicyScopeAccountReference) isaBackupPolicyScope() bool { + return true +} + +// UnmarshalBackupPolicyScopeAccountReference unmarshals an instance of BackupPolicyScopeAccountReference from the specified map of raw messages. +func UnmarshalBackupPolicyScopeAccountReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopeAccountReference) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyScopeEnterpriseReference : BackupPolicyScopeEnterpriseReference struct +// This model "extends" BackupPolicyScope +type BackupPolicyScopeEnterpriseReference struct { + // The CRN for this enterprise. + CRN *string `json:"crn" validate:"required"` + + // The unique identifier for this enterprise. + ID *string `json:"id" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the BackupPolicyScopeEnterpriseReference.ResourceType property. +// The resource type. +const ( + BackupPolicyScopeEnterpriseReferenceResourceTypeEnterpriseConst = "enterprise" +) + +func (*BackupPolicyScopeEnterpriseReference) isaBackupPolicyScope() bool { + return true +} + +// UnmarshalBackupPolicyScopeEnterpriseReference unmarshals an instance of BackupPolicyScopeEnterpriseReference from the specified map of raw messages. +func UnmarshalBackupPolicyScopeEnterpriseReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopeEnterpriseReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BareMetalServerBootTargetBareMetalServerDiskReference : BareMetalServerBootTargetBareMetalServerDiskReference struct // This model "extends" BareMetalServerBootTarget type BareMetalServerBootTargetBareMetalServerDiskReference struct { @@ -88274,7 +88472,7 @@ type PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct { Name *string `json:"name,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` } @@ -88920,10 +89118,6 @@ type ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext str // The CRN for this virtual network interface. CRN *string `json:"crn" validate:"required"` - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted `json:"deleted,omitempty"` - // The URL for this virtual network interface. Href *string `json:"href" validate:"required"` @@ -88954,10 +89148,6 @@ func UnmarshalReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetCo if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -91039,16 +91229,15 @@ type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceProt // an available address on the subnet will be automatically selected and reserved. PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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 and - // `primary_ip.address` is not specified. + // The associated subnet. Required if `primary_ip` does not specify a reserved IP. Subnet SubnetIdentityIntf `json:"subnet,omitempty"` } @@ -91561,7 +91750,7 @@ type SharePrototypeShareBySize struct { InitialOwner *ShareInitialOwner `json:"initial_owner,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The size of the file share rounded up to the next gigabyte. @@ -94969,6 +95158,41 @@ func UnmarshalZoneIdentityByName(m map[string]json.RawMessage, result interface{ return } +// BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN : BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN struct +// This model "extends" BackupPolicyScopePrototypeEnterpriseIdentity +type BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN struct { + // The CRN for this enterprise. + CRN *string `json:"crn" validate:"required"` +} + +// NewBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN : Instantiate BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN(crn string) (_model *BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN, err error) { + _model = &BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) isaBackupPolicyScopePrototypeEnterpriseIdentity() bool { + return true +} + +func (*BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) isaBackupPolicyScopePrototype() bool { + return true +} + +// UnmarshalBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN unmarshals an instance of BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN from the specified map of raw messages. +func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // EndpointGatewayReservedIPReservedIPIdentityByHref : EndpointGatewayReservedIPReservedIPIdentityByHref struct // This model "extends" EndpointGatewayReservedIPReservedIPIdentity type EndpointGatewayReservedIPReservedIPIdentityByHref struct { diff --git a/examples/ibm-is-ng/main.tf b/examples/ibm-is-ng/main.tf index b4ce696697..a3e74809b9 100644 --- a/examples/ibm-is-ng/main.tf +++ b/examples/ibm-is-ng/main.tf @@ -1143,6 +1143,20 @@ data "ibm_is_backup_policy_plan" "is_backup_policy_plan" { name = "my-backup-policy-plan" } +//backup policies for enterprise + +resource "ibm_is_backup_policy" "ent-baas-example" { + match_user_tags = ["tag1"] + name = "example-enterprise-backup-policy" + scope { + crn = "crn:v1:bluemix:public:is:us-south:a/123456::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63" + } +} + +data "ibm_is_backup_policy" "enterprise_backup" { + name = ibm_is_backup_policy.ent-baas-example.name +} + // Vpn Server resource "ibm_is_vpn_server" "is_vpn_server" { certificate_crn = var.is_certificate_crn diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index 00957a3a8d..54513583d9 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -68,6 +68,7 @@ var ( UpdatedCertCRN string SecretCRN string SecretCRN2 string + EnterpriseCRN string InstanceCRN string SecretGroupID string RegionName string @@ -1444,6 +1445,11 @@ func init() { fmt.Println("[WARN] Set the environment variable IES_API_KEY for testing Event streams targets, the tests will fail if this is not set") } + EnterpriseCRN = os.Getenv("ENTERPRISE_CRN") + if EnterpriseCRN == "" { + fmt.Println("[WARN] Set the environment variable ENTERPRISE_CRN for testing enterprise backup policy, the tests will fail if this is not set") + } + CeResourceGroupID = os.Getenv("IBM_CODE_ENGINE_RESOURCE_GROUP_ID") if CeResourceGroupID == "" { CeResourceGroupID = "" diff --git a/ibm/service/vpc/data_source_ibm_is_backup_policies.go b/ibm/service/vpc/data_source_ibm_is_backup_policies.go index 1ca4bde5be..d9f03c7f53 100644 --- a/ibm/service/vpc/data_source_ibm_is_backup_policies.go +++ b/ibm/service/vpc/data_source_ibm_is_backup_policies.go @@ -166,6 +166,59 @@ func DataSourceIBMIsBackupPolicies() *schema.Resource { Computed: true, Description: "The type of resource referenced.", }, + "health_reasons": { + Type: schema.TypeList, + Computed: true, + Description: "The reasons for the current health_state (if any).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "code": { + Type: schema.TypeString, + Computed: true, + Description: "A snake case string succinctly identifying the reason for this health state.", + }, + "message": { + Type: schema.TypeString, + Computed: true, + Description: "An explanation of the reason for this health state.", + }, + "more_info": { + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about the reason for this health state.", + }, + }, + }, + }, + "health_state": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The health of this resource", + }, + "scope": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The scope for this backup policy.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this enterprise.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this enterprise or account.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, }, }, }, @@ -298,10 +351,58 @@ func dataSourceBackupPolicyCollectionBackupPoliciesToMap(backupPoliciesItem vpcv if backupPoliciesItem.ResourceType != nil { backupPoliciesMap["resource_type"] = backupPoliciesItem.ResourceType } + if backupPoliciesItem.HealthReasons != nil { + healthReasonsList := []map[string]interface{}{} + for _, healthReasonsItem := range backupPoliciesItem.HealthReasons { + healthReasonsList = append(healthReasonsList, dataSourceBackupPolicyCollectionPoliciesHealthReasonsToMap(healthReasonsItem)) + } + backupPoliciesMap["health_reasons"] = healthReasonsList + } + if backupPoliciesItem.HealthState != nil { + backupPoliciesMap["health_state"] = backupPoliciesItem.HealthState + } + if backupPoliciesItem.Scope != nil { + scopeList := []map[string]interface{}{} + scopeMap := dataSourceBackupPolicyCollectionBackupPoliciesScopeToMap(*backupPoliciesItem.Scope.(*vpcv1.BackupPolicyScope)) + scopeList = append(scopeList, scopeMap) + backupPoliciesMap["scope"] = scopeList + } return backupPoliciesMap } +func dataSourceBackupPolicyCollectionPoliciesHealthReasonsToMap(statusReasonsItem vpcv1.BackupPolicyHealthReason) (healthReasonsMap map[string]interface{}) { + healthReasonsMap = map[string]interface{}{} + + if statusReasonsItem.Code != nil { + healthReasonsMap["code"] = statusReasonsItem.Code + } + if statusReasonsItem.Message != nil { + healthReasonsMap["message"] = statusReasonsItem.Message + } + if statusReasonsItem.MoreInfo != nil { + healthReasonsMap["more_info"] = statusReasonsItem.MoreInfo + } + + return healthReasonsMap +} + +func dataSourceBackupPolicyCollectionBackupPoliciesScopeToMap(scopeItem vpcv1.BackupPolicyScope) (scopeMap map[string]interface{}) { + scopeMap = map[string]interface{}{} + + if scopeItem.CRN != nil { + scopeMap["crn"] = scopeItem.CRN + } + if scopeItem.ID != nil { + scopeMap["id"] = scopeItem.ID + } + if scopeItem.ResourceType != nil { + scopeMap["resource_type"] = scopeItem.ResourceType + } + + return scopeMap +} + func dataSourceBackupPolicyCollectionBackupPoliciesPlansToMap(plansItem vpcv1.BackupPolicyPlanReference) (plansMap map[string]interface{}) { plansMap = map[string]interface{}{} diff --git a/ibm/service/vpc/data_source_ibm_is_backup_policy.go b/ibm/service/vpc/data_source_ibm_is_backup_policy.go index 1aa3b6ca81..7baaafa6cb 100644 --- a/ibm/service/vpc/data_source_ibm_is_backup_policy.go +++ b/ibm/service/vpc/data_source_ibm_is_backup_policy.go @@ -149,6 +149,59 @@ func DataSourceIBMIsBackupPolicy() *schema.Resource { Computed: true, Description: "The type of resource referenced.", }, + "health_reasons": { + Type: schema.TypeList, + Computed: true, + Description: "The reasons for the current health_state (if any).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "code": { + Type: schema.TypeString, + Computed: true, + Description: "A snake case string succinctly identifying the reason for this health state.", + }, + "message": { + Type: schema.TypeString, + Computed: true, + Description: "An explanation of the reason for this health state.", + }, + "more_info": { + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about the reason for this health state.", + }, + }, + }, + }, + "health_state": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The health of this resource", + }, + "scope": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The scope for this backup policy.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this enterprise.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this enterprise or account.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, }, } } @@ -237,6 +290,32 @@ func dataSourceIBMIsBackupPolicyRead(context context.Context, d *schema.Resource } } + if backupPolicy.HealthReasons != nil { + healthReasonsList := make([]map[string]interface{}, 0) + for _, sr := range backupPolicy.HealthReasons { + currentSR := map[string]interface{}{} + if sr.Code != nil && sr.Message != nil { + currentSR["code"] = *sr.Code + currentSR["message"] = *sr.Message + if sr.MoreInfo != nil { + currentSR["more_info"] = *sr.Message + } + healthReasonsList = append(healthReasonsList, currentSR) + } + } + d.Set("health_reasons", healthReasonsList) + } + if err = d.Set("health_state", backupPolicy.HealthState); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting health_state: %s", err)) + } + + if backupPolicy.Scope != nil { + err = d.Set("scope", dataSourceBackupPolicyFlattenScope(*backupPolicy.Scope.(*vpcv1.BackupPolicyScope))) + if err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting scope: %s", err)) + } + } + matchResourceType := make([]string, 0) if backupPolicy.MatchResourceTypes != nil { for _, matchResourceTyp := range backupPolicy.MatchResourceTypes { @@ -266,6 +345,29 @@ func dataSourceIBMIsBackupPolicyRead(context context.Context, d *schema.Resource return nil } +func dataSourceBackupPolicyFlattenScope(result vpcv1.BackupPolicyScope) (finalList []map[string]interface{}) { + finalList = []map[string]interface{}{} + finalMap := dataSourceBackupPolicyScopeToMap(result) + finalList = append(finalList, finalMap) + + return finalList +} +func dataSourceBackupPolicyScopeToMap(scopeItem vpcv1.BackupPolicyScope) (scopeMap map[string]interface{}) { + scopeMap = map[string]interface{}{} + + if scopeItem.CRN != nil { + scopeMap["crn"] = scopeItem.CRN + } + if scopeItem.ID != nil { + scopeMap["id"] = scopeItem.ID + } + if scopeItem.ResourceType != nil { + scopeMap["resource_type"] = scopeItem.ResourceType + } + + return scopeMap +} + func dataSourceBackupPolicyFlattenPlans(result []vpcv1.BackupPolicyPlanReference) (plans []map[string]interface{}) { for _, plansItem := range result { plans = append(plans, dataSourceBackupPolicyPlansToMap(plansItem)) diff --git a/ibm/service/vpc/data_source_ibm_is_bare_metal_servers.go b/ibm/service/vpc/data_source_ibm_is_bare_metal_servers.go index b659a318b2..d3ad3b6409 100644 --- a/ibm/service/vpc/data_source_ibm_is_bare_metal_servers.go +++ b/ibm/service/vpc/data_source_ibm_is_bare_metal_servers.go @@ -485,18 +485,18 @@ func dataSourceIBMISBareMetalServersRead(context context.Context, d *schema.Reso vpcCrn := vpcCrnIntf.(string) listBareMetalServersOptions.VPCCRN = &vpcCrn } - if subnetIntf, ok := d.GetOk("network_interfaces_subnet"); ok { - subnetId := subnetIntf.(string) - listBareMetalServersOptions.NetworkInterfacesSubnetID = &subnetId - } - if subnetNameIntf, ok := d.GetOk("network_interfaces_subnet_name"); ok { - subnetName := subnetNameIntf.(string) - listBareMetalServersOptions.NetworkInterfacesSubnetName = &subnetName - } - if subnetCrnIntf, ok := d.GetOk("network_interfaces_subnet_crn"); ok { - subnetCrn := subnetCrnIntf.(string) - listBareMetalServersOptions.NetworkInterfacesSubnetCRN = &subnetCrn - } + // if subnetIntf, ok := d.GetOk("network_interfaces_subnet"); ok { + // subnetId := subnetIntf.(string) + // listBareMetalServersOptions.NetworkInterfacesSubnetID = &subnetId + // } + // if subnetNameIntf, ok := d.GetOk("network_interfaces_subnet_name"); ok { + // subnetName := subnetNameIntf.(string) + // listBareMetalServersOptions.NetworkInterfacesSubnetName = &subnetName + // } + // if subnetCrnIntf, ok := d.GetOk("network_interfaces_subnet_crn"); ok { + // subnetCrn := subnetCrnIntf.(string) + // listBareMetalServersOptions.NetworkInterfacesSubnetCRN = &subnetCrn + // } for { if start != "" { diff --git a/ibm/service/vpc/data_source_ibm_is_share_mount_target.go b/ibm/service/vpc/data_source_ibm_is_share_mount_target.go index 0da8b036af..f1da5dd2bf 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_mount_target.go +++ b/ibm/service/vpc/data_source_ibm_is_share_mount_target.go @@ -443,12 +443,6 @@ func dataSourceShareTargetVNIToMap(VNIItem vpcv1.VirtualNetworkInterfaceReferenc if VNIItem.CRN != nil { subnetMap["crn"] = VNIItem.CRN } - if VNIItem.Deleted != nil { - deletedList := []map[string]interface{}{} - deletedMap := dataSourceShareTargetVNIDeletedToMap(*VNIItem.Deleted) - deletedList = append(deletedList, deletedMap) - subnetMap["deleted"] = deletedList - } if VNIItem.Href != nil { subnetMap["href"] = VNIItem.Href } @@ -465,13 +459,3 @@ func dataSourceShareTargetVNIToMap(VNIItem vpcv1.VirtualNetworkInterfaceReferenc return subnetMap } - -func dataSourceShareTargetVNIDeletedToMap(deletedItem vpcv1.VirtualNetworkInterfaceReferenceAttachmentContextDeleted) (deletedMap map[string]interface{}) { - deletedMap = map[string]interface{}{} - - if deletedItem.MoreInfo != nil { - deletedMap["more_info"] = deletedItem.MoreInfo - } - - return deletedMap -} diff --git a/ibm/service/vpc/resource_ibm_is_backup_policy.go b/ibm/service/vpc/resource_ibm_is_backup_policy.go index c2d16166ee..9460b5d6ca 100644 --- a/ibm/service/vpc/resource_ibm_is_backup_policy.go +++ b/ibm/service/vpc/resource_ibm_is_backup_policy.go @@ -88,6 +88,61 @@ func ResourceIBMIsBackupPolicy() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "health_reasons": { + Type: schema.TypeList, + Computed: true, + Description: "The reasons for the current health_state (if any).", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "code": { + Type: schema.TypeString, + Computed: true, + Description: "A snake case string succinctly identifying the reason for this health state.", + }, + "message": { + Type: schema.TypeString, + Computed: true, + Description: "An explanation of the reason for this health state.", + }, + "more_info": { + Type: schema.TypeString, + Computed: true, + Description: "Link to documentation about the reason for this health state.", + }, + }, + }, + }, + "health_state": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The health of this resource", + }, + "scope": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Optional: true, + MaxItems: 1, + Description: "The scope for this backup policy.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The CRN for this enterprise.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique identifier for this enterprise or account.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, }, } } @@ -156,6 +211,17 @@ func resourceIBMIsBackupPolicyCreate(context context.Context, d *schema.Resource createBackupPolicyOptions.SetResourceGroup(&resourceGroup) } + if _, ok := d.GetOk("scope"); ok { + bkpPolicyScopePrototypeMap := d.Get("scope.0").(map[string]interface{}) + bkpPolicyScopePrototype := vpcv1.BackupPolicyScopePrototype{} + if bkpPolicyScopePrototypeMap["crn"] != nil { + if crnStr := bkpPolicyScopePrototypeMap["crn"].(string); crnStr != "" { + bkpPolicyScopePrototype.CRN = core.StringPtr(crnStr) + } + } + createBackupPolicyOptions.SetScope(&bkpPolicyScopePrototype) + } + backupPolicy, response, err := vpcClient.CreateBackupPolicyWithContext(context, createBackupPolicyOptions) if err != nil { log.Printf("[DEBUG] CreateBackupPolicyWithContext failed %s\n%s", err, response) @@ -244,6 +310,35 @@ func resourceIBMIsBackupPolicyRead(context context.Context, d *schema.ResourceDa } } + if backupPolicy.HealthReasons != nil { + healthReasonsList := make([]map[string]interface{}, 0) + for _, sr := range backupPolicy.HealthReasons { + currentSR := map[string]interface{}{} + if sr.Code != nil && sr.Message != nil { + currentSR["code"] = *sr.Code + currentSR["message"] = *sr.Message + if sr.MoreInfo != nil { + currentSR["more_info"] = *sr.Message + } + healthReasonsList = append(healthReasonsList, currentSR) + } + } + d.Set("health_reasons", healthReasonsList) + } + if err = d.Set("health_state", backupPolicy.HealthState); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting health_state: %s", err)) + } + + if backupPolicy.Scope != nil { + scope := []map[string]interface{}{} + scopeMap := resourceIbmIsBackupPolicyScopeToMap(*backupPolicy.Scope.(*vpcv1.BackupPolicyScope)) + scope = append(scope, scopeMap) + + if err = d.Set("scope", scope); err != nil { + return diag.FromErr(fmt.Errorf("[ERROR] Error setting scope: %s", err)) + } + } + if err = d.Set("version", response.Headers.Get("Etag")); err != nil { return diag.FromErr(fmt.Errorf("[ERROR] Error setting version: %s", err)) } @@ -251,6 +346,16 @@ func resourceIBMIsBackupPolicyRead(context context.Context, d *schema.ResourceDa return nil } +func resourceIbmIsBackupPolicyScopeToMap(scope vpcv1.BackupPolicyScope) map[string]interface{} { + scopeMap := map[string]interface{}{} + + scopeMap["crn"] = scope.CRN + scopeMap["id"] = scope.ID + scopeMap["resource_type"] = scope.ResourceType + + return scopeMap +} + func resourceIBMIsBackupPolicyUpdate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { vpcClient, err := vpcClient(meta) if err != nil { diff --git a/ibm/service/vpc/resource_ibm_is_backup_policy_test.go b/ibm/service/vpc/resource_ibm_is_backup_policy_test.go index da096e107e..3d8f9d1594 100644 --- a/ibm/service/vpc/resource_ibm_is_backup_policy_test.go +++ b/ibm/service/vpc/resource_ibm_is_backup_policy_test.go @@ -143,3 +143,48 @@ func testAccCheckIBMIsBackupPolicyDestroy(s *terraform.State) error { return nil } + +func TestAccIBMIsBackupPolicyBasicWithScope(t *testing.T) { + backupPolicyName := fmt.Sprintf("tfbakuppolicyname%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMIsBackupPolicyDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsBackupPolicyConfigBasicWithScope(backupPolicyName, acc.EnterpriseCRN), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("ibm_is_backup_policy.is_backup_policy", "name", backupPolicyName), + resource.TestCheckResourceAttrSet("ibm_is_backup_policy.is_backup_policy", "match_resource_types.#"), + resource.TestCheckResourceAttrSet("ibm_is_backup_policy.is_backup_policy", "match_user_tags.#"), + resource.TestCheckResourceAttrSet("ibm_is_backup_policy.is_backup_policy", "resource_group"), + resource.TestCheckResourceAttrSet("ibm_is_backup_policy.is_backup_policy", "created_at"), + resource.TestCheckResourceAttrSet("ibm_is_backup_policy.is_backup_policy", "crn"), + resource.TestCheckResourceAttrSet("ibm_is_backup_policy.is_backup_policy", "href"), + resource.TestCheckResourceAttrSet("ibm_is_backup_policy.is_backup_policy", "scope.#"), + resource.TestCheckResourceAttrSet("ibm_is_backup_policy.is_backup_policy", "scope.0.id"), + resource.TestCheckResourceAttrSet("ibm_is_backup_policy.is_backup_policy", "lifecycle_state"), + resource.TestCheckResourceAttrSet("ibm_is_backup_policy.is_backup_policy", "resource_type"), + resource.TestCheckResourceAttrSet("ibm_is_backup_policy.is_backup_policy", "version"), + ), + }, + { + ResourceName: "ibm_is_backup_policy.is_backup_policy", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccCheckIBMIsBackupPolicyConfigBasicWithScope(backupPolicyName, entCrn string) string { + return fmt.Sprintf(` + resource "ibm_is_backup_policy" "is_backup_policy" { + match_user_tags = ["dev:test"] + name = "%s" + scope { + crn = "%s" + } + }`, backupPolicyName, entCrn) +} diff --git a/website/docs/d/is_backup_policies.html.markdown b/website/docs/d/is_backup_policies.html.markdown index 3b21acabf4..3e36540ebe 100644 --- a/website/docs/d/is_backup_policies.html.markdown +++ b/website/docs/d/is_backup_policies.html.markdown @@ -45,6 +45,13 @@ In addition to all argument reference list, you can access the following attribu Nested `backup_policies` blocks have the following structure: - `created_at` - (String) The date and time that the backup policy was created. - `crn` - (String) The CRN for this backup policy. + - `health_reasons` - (List) The reasons for the current health_state (if any). + + Nested scheme for `health_reasons`: + - `code` - (String) A snake case string succinctly identifying the reason for this health state. + - `message` - (String) An explanation of the reason for this health state. + - `more_info` - (String) Link to documentation about the reason for this health state. + - `health_state` - (String) The health of this resource. - `href` - (String) The URL for this backup policy. - `id` - (String) The unique identifier for this backup policy. - `last_job_completed_at` - (String) he date and time that the most recent job for this backup policy completed. @@ -63,11 +70,17 @@ In addition to all argument reference list, you can access the following attribu - `id` - (String) The unique identifier for this backup policy plan. - `name` - (String) The unique user-defined name for this backup policy plan. - `resource_type` - (String) The type of resource referenced. - - `resource_group` - (List) The resource group object, for this backup policy. + - `resource_group` - (List) The resource group object, for this backup policy. Nested `resource_group` blocks have the following structure: - `href` - (String) The URL for this resource group. - `id` - (String) The unique identifier for this resource group. - `name` - (String) The user-defined name for this resource group. + - `scope` - (List) If present, the scope for this backup policy. + + Nested `scope` blocks have the following structure: + - `crn` - (String) The CRN for this enterprise. + - `id` - (String) The unique identifier for this enterprise or account. + - `resource_type` - (String) The resource type. diff --git a/website/docs/d/is_backup_policy.html.markdown b/website/docs/d/is_backup_policy.html.markdown index c6e2a1119b..6513f31bfa 100644 --- a/website/docs/d/is_backup_policy.html.markdown +++ b/website/docs/d/is_backup_policy.html.markdown @@ -42,6 +42,13 @@ In addition to all argument reference list, you can access the following attribu - `id` - The unique identifier of the BackupPolicy. - `created_at` - (String) The date and time that the backup policy was created. - `crn` - (String) The CRN for this backup policy. +- `health_reasons` - (List) The reasons for the current health_state (if any). + + Nested scheme for `health_reasons`: + - `code` - (String) A snake case string succinctly identifying the reason for this health state. + - `message` - (String) An explanation of the reason for this health state. + - `more_info` - (String) Link to documentation about the reason for this health state. +- `health_state` - (String) The health of this resource. - `href` - (String) The URL for this backup policy. - `last_job_completed_at` - (String) he date and time that the most recent job for this backup policy completed. - `lifecycle_state` - (String) The lifecycle state of the backup policy. @@ -66,4 +73,11 @@ In addition to all argument reference list, you can access the following attribu - `id` - (String) The unique identifier for this resource group. - `name` - (String) The user-defined name for this resource group. - `resource_type` - (String) The type of resource referenced. +- `scope` - (List) If present, the scope for this backup policy. + + Nested `scope` blocks have the following structure: + - `crn` - (String) The CRN for this enterprise. + - `id` - (String) The unique identifier for this enterprise or account. + - `resource_type` - (String) The resource type. + diff --git a/website/docs/d/is_bare_metal_servers.markdown b/website/docs/d/is_bare_metal_servers.markdown index 58cf01fdaf..f94867efd5 100644 --- a/website/docs/d/is_bare_metal_servers.markdown +++ b/website/docs/d/is_bare_metal_servers.markdown @@ -36,9 +36,6 @@ Review the argument references that you can specify for your data source. - `vpc_name` (Optional, String) The name of the vpc this bare metal server is in - `vpc_crn` (Optional, String) The CRN of the vpc this bare metal server is in - `name` - (Optional, String) The name of the dedicated host group -- `network_interfaces_subnet` - (Optional, String) The ID of the subnet of the bare metal server network interfaces -- `network_interfaces_subnet_crn` - (Optional, String) The CRN of the subnet of the bare metal server network interfaces -- `network_interfaces_subnet_name` - (Optional, String) The name of the subnet of the bare metal server network interfaces ## Attribute Reference diff --git a/website/docs/r/is_backup_policy.html.markdown b/website/docs/r/is_backup_policy.html.markdown index a6b1a5d179..35876f0798 100644 --- a/website/docs/r/is_backup_policy.html.markdown +++ b/website/docs/r/is_backup_policy.html.markdown @@ -31,6 +31,18 @@ resource "ibm_is_backup_policy" "example" { } ``` +## Example Usage (enterprise baas) + +```terraform +resource "ibm_is_backup_policy" "ent-baas-example1" { + match_user_tags = ["tag1"] + name = "example-backup-policy" + scope { + crn = "crn:v1:bluemix:public:is:us-south:a/123456::reservation:7187-ba49df72-37b8-43ac-98da-f8e029de0e63" + } +} +``` + ## Argument Reference Review the argument reference that you can specify for your resource. @@ -42,6 +54,9 @@ Review the argument reference that you can specify for your resource. Nested scheme for `resource_group`: - `id` - (Optional, String) The unique identifier for this resource group. +- `scope` - (Optional, List) If present, the scope for this backup policy. + Nested `scope` blocks have the following structure: + - `crn` - (Required, String) The CRN for this enterprise. ## Attribute Reference @@ -50,10 +65,22 @@ In addition to all argument references listed, you can access the following attr - `id` - The unique identifier of the BackupPolicy. - `created_at` - (String) The date and time that the backup policy was created. - `crn` - (String) The CRN for this backup policy. +- `health_reasons` - (List) The reasons for the current health_state (if any). + + Nested scheme for `health_reasons`: + - `code` - (String) A snake case string succinctly identifying the reason for this health state. + - `message` - (String) An explanation of the reason for this health state. + - `more_info` - (String) Link to documentation about the reason for this health state. +- `health_state` - (String) The health of this resource. - `href` - (String) The URL for this backup policy. - `last_job_completed_at` - (String) The date and time that the most recent job for this backup policy completed. - `lifecycle_state` - (String) The lifecycle state of the backup policy. - `resource_type` - (String) The resource type. +- `scope` - Scope of this backup policy + Nested `scope`: + - `crn` - (String) The CRN for this enterprise. + - `id` - (String) The unique identifier for this enterprise. + - `resource_type` - (String) The resource type. - `version` - Version of the BackupPolicy. ## Import