From e2e4c99f5c0c0221bbf7f34c392816c8f84de58b Mon Sep 17 00:00:00 2001 From: Deeksha Sharma Date: Thu, 27 Nov 2025 14:20:33 +0530 Subject: [PATCH 1/3] - update code for latest iks-roks changes in v7.2.16 --- go.mod | 18 +- go.sum | 36 +- .../data_source_ibm_backup_recoveries.go | 571 +++- .../data_source_ibm_backup_recovery.go | 571 +++- ...ce_ibm_backup_recovery_protection_group.go | 369 +++ ...e_ibm_backup_recovery_protection_groups.go | 369 +++ ..._ibm_backup_recovery_protection_sources.go | 2827 +++++++++++++++-- ...ibm_backup_recovery_source_registration.go | 12 +- ...bm_backup_recovery_source_registrations.go | 8 + .../resource_ibm_backup_recovery.go | 766 ++++- ...ce_ibm_backup_recovery_protection_group.go | 476 ++- ...ibm_backup_recovery_source_registration.go | 11 + 12 files changed, 5737 insertions(+), 297 deletions(-) diff --git a/go.mod b/go.mod index dd713e7107..afc9383df6 100644 --- a/go.mod +++ b/go.mod @@ -60,7 +60,7 @@ require ( github.com/rook/rook/pkg/apis v0.0.0-20250619203122-80563e28b685 github.com/softlayer/softlayer-go v1.0.3 github.com/stretchr/testify v1.11.1 - golang.org/x/crypto v0.41.0 + golang.org/x/crypto v0.45.0 gopkg.in/yaml.v3 v3.0.1 gotest.tools v2.2.0+incompatible k8s.io/api v0.33.4 @@ -196,15 +196,15 @@ require ( go.uber.org/automaxprocs v1.6.0 // indirect go.uber.org/ratelimit v0.2.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/mod v0.26.0 // indirect - golang.org/x/net v0.43.0 // indirect + golang.org/x/mod v0.29.0 // indirect + golang.org/x/net v0.47.0 // indirect golang.org/x/oauth2 v0.27.0 // indirect - golang.org/x/sync v0.16.0 // indirect - golang.org/x/sys v0.36.0 // indirect - golang.org/x/term v0.34.0 // indirect - golang.org/x/text v0.28.0 // indirect + golang.org/x/sync v0.18.0 // indirect + golang.org/x/sys v0.38.0 // indirect + golang.org/x/term v0.37.0 // indirect + golang.org/x/text v0.31.0 // indirect golang.org/x/time v0.9.0 // indirect - golang.org/x/tools v0.35.0 // indirect + golang.org/x/tools v0.38.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect google.golang.org/grpc v1.72.1 // indirect @@ -238,3 +238,5 @@ exclude ( k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible k8s.io/client-go v12.0.0+incompatible ) + +replace github.com/IBM/ibm-backup-recovery-sdk-go => /Users/deekshasharma/Documents/git/baas-go-sdk/helios-baas-go/ibm-backup-recovery-sdk-go diff --git a/go.sum b/go.sum index 2adaa1b62f..f83a63552a 100644 --- a/go.sum +++ b/go.sum @@ -127,8 +127,6 @@ github.com/IBM/go-sdk-core/v5 v5.10.2/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2y github.com/IBM/go-sdk-core/v5 v5.17.4/go.mod h1:KsAAI7eStAWwQa4F96MLy+whYSh39JzNjklZRbN/8ns= github.com/IBM/go-sdk-core/v5 v5.21.0 h1:DUnYhvC4SoC8T84rx5omnhY3+xcQg/Whyoa3mDPIMkk= github.com/IBM/go-sdk-core/v5 v5.21.0/go.mod h1:Q3BYO6iDA2zweQPDGbNTtqft5tDcEpm6RTuqMlPcvbw= -github.com/IBM/ibm-backup-recovery-sdk-go v1.0.5 h1:bVf67pkGi5dp8SQXMcam8c1JrEwNRkXVcz3FkaalmYg= -github.com/IBM/ibm-backup-recovery-sdk-go v1.0.5/go.mod h1:m+7lHOrXJwYPbrdxMmKl96tT7OJMMhpyKnQgnaCcy+w= github.com/IBM/ibm-cos-sdk-go v1.12.2 h1:71A4tDl8u6BZ548h71ecEe7fw5bBA7ECTVqYmeSQWQA= github.com/IBM/ibm-cos-sdk-go v1.12.2/go.mod h1:ODYcmrmdpjo5hVguq9RbD6xmC8xb1XZMG7NefUbJNcc= github.com/IBM/ibm-cos-sdk-go-config/v2 v2.3.0 h1:956Nqk0eKI3lq+AkzWXZDid4UZHRz0wWh1LwkleBsWk= @@ -168,8 +166,6 @@ github.com/IBM/vmware-go-sdk v0.1.5 h1:aQbwcJBceaaauuIoJ0OJn+ttwjb+QTX6XV9Jbrdpj github.com/IBM/vmware-go-sdk v0.1.5/go.mod h1:OyQKRInGGsBaOyE5LIZCqH7b1DZ01BvIYa8BgGy+wWo= github.com/IBM/vpc-beta-go-sdk v0.8.0 h1:cEPpv4iw3Ba5W2d0AWg3TIbKeJ8y1nPuUuibR5Jt9eE= github.com/IBM/vpc-beta-go-sdk v0.8.0/go.mod h1:hORgIyTFRzXrZIK9IohaWmCRBBlYiDRagsufi7M6akE= -github.com/IBM/vpc-go-sdk v0.74.1 h1:qkWwdlILx3ZVNWht96CdlPKwhKL/y3ItN6XmwJ1rShM= -github.com/IBM/vpc-go-sdk v0.74.1/go.mod h1:8lX6TpeYBbx1Vd4KTgM3PPQ4y3auGOPuD6qq3UBDdug= github.com/IBM/vpc-go-sdk v0.75.0 h1:8s11vR30n0eY9ptf6Osh9Bw13okhMVasb/KX9M52LEg= github.com/IBM/vpc-go-sdk v0.75.0/go.mod h1:8lX6TpeYBbx1Vd4KTgM3PPQ4y3auGOPuD6qq3UBDdug= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= @@ -1314,8 +1310,8 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= -golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= -golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= +golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= +golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1360,8 +1356,8 @@ golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg= -golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ= +golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA= +golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1439,8 +1435,8 @@ golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= -golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= +golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1480,8 +1476,8 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= -golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I= +golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1599,8 +1595,8 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= -golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= +golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1619,8 +1615,8 @@ golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= -golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= -golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= +golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU= +golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1642,8 +1638,8 @@ golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM= +golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1734,8 +1730,8 @@ golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ= +golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/ibm/service/backuprecovery/data_source_ibm_backup_recoveries.go b/ibm/service/backuprecovery/data_source_ibm_backup_recoveries.go index 4ae32a8d27..6f82f129ce 100644 --- a/ibm/service/backuprecovery/data_source_ibm_backup_recoveries.go +++ b/ibm/service/backuprecovery/data_source_ibm_backup_recoveries.go @@ -2284,13 +2284,66 @@ func DataSourceIbmBackupRecoveries() *schema.Resource { Type: schema.TypeInt, }, }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, }, }, }, "excluded_pvcs": &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: "Specifies the list of pvc to be excluded from recovery.", + Description: "Specifies the list of pvc to be excluded from recovery. This will be deprecated in the future. This is overridden by the object level param.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": &schema.Schema{ @@ -2344,6 +2397,59 @@ func DataSourceIbmBackupRecoveries() *schema.Resource { Type: schema.TypeInt, }, }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, }, }, }, @@ -2837,6 +2943,251 @@ func DataSourceIbmBackupRecoveries() *schema.Resource { Computed: true, Description: "Specify the total bytes restored.", }, + "exclude_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the parameters to in/exclude objects (e.g.: volumes). An object satisfying any of these criteria will be included by this filter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "label_combination_method": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Whether to include all the labels or any of them while performing inclusion/exclusion of objects.", + }, + "label_vector": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object to represent Label that Specify Objects (e.g.: Persistent Volumes and Persistent Volume Claims) to Include or Exclude.It will be a two-dimensional array, where each inner array will consist of a key and value representing labels. Using this two dimensional array of Labels, the Cluster generates a list of items to include in the filter, which are derived from intersections or the union of these labels, as decided by operation parameter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The key of the label, used to identify the label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The value associated with the label key.", + }, + }, + }, + }, + "objects": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of objects that are to be included.", + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, + }, + }, + }, + "include_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the parameters to in/exclude objects (e.g.: volumes). An object satisfying any of these criteria will be included by this filter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "label_combination_method": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Whether to include all the labels or any of them while performing inclusion/exclusion of objects.", + }, + "label_vector": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object to represent Label that Specify Objects (e.g.: Persistent Volumes and Persistent Volume Claims) to Include or Exclude.It will be a two-dimensional array, where each inner array will consist of a key and value representing labels. Using this two dimensional array of Labels, the Cluster generates a list of items to include in the filter, which are derived from intersections or the union of these labels, as decided by operation parameter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The key of the label, used to identify the label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The value associated with the label key.", + }, + }, + }, + }, + "objects": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of objects that are to be included.", + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, + }, + }, + }, + "recover_pvcs_only": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether to recover PVCs only during recovery. Default: false.", + }, + "storage_class": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the storage class parameters for recovery of namespace.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "storage_class_mapping": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies mapping of storage classes.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The key of the label, used to identify the label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The value associated with the label key.", + }, + }, + }, + }, + "use_storage_class_mapping": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether or not to use storage class mapping.", + }, + }, + }, + }, + "unbind_pvcs": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether the volume bindings will be removed from all restored PVCs. This will effectively unbind the PVCs from their original PVs. Default: false.", + }, + }, + }, + }, + "recover_cluster_scoped_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the parameters from where the cluster scoped resources would be recovered.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "snapshot_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the snapshot id of the namespace from where the cluster scoped resources are to be recovered.", + }, }, }, }, @@ -2872,7 +3223,26 @@ func DataSourceIbmBackupRecoveries() *schema.Resource { "recover_pvcs_only": &schema.Schema{ Type: schema.TypeBool, Computed: true, - Description: "Specifies whether to recover PVCs only during recovery.", + Description: "Specifies whether to recover PVCs only during recovery.. This is overridden with the object level settings and will be deprecated in the future.", + }, + "recovery_region_migration_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies an individual migration rule for mapping a region/zone to another for cross region recovery.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "current_value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the current value for the mapping that needs to be mutated.", + }, + "new_value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the new value for the mapping with which the fields need to be updated with.", + }, + }, + }, }, "recovery_target_config": &schema.Schema{ Type: schema.TypeList, @@ -2916,6 +3286,25 @@ func DataSourceIbmBackupRecoveries() *schema.Resource { }, }, }, + "recovery_zone_migration_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies rules for performing zone migrations during recovery. Used in case of recovery to new location and the namespace being recovered is in a different zone.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "current_value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the current value for the mapping that needs to be mutated.", + }, + "new_value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the new value for the mapping with which the fields need to be updated with.", + }, + }, + }, + }, "rename_recovered_namespaces_params": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -5329,7 +5718,7 @@ func DataSourceIbmBackupRecoveriesRecoverKubernetesNamespaceParamsKubernetesTarg if model.Objects != nil { objects := []map[string]interface{}{} for _, objectsItem := range model.Objects { - objectsItemMap, err := DataSourceIbmBackupRecoveriesCommonRecoverObjectSnapshotParamsToMap(&objectsItem) // #nosec G601 + objectsItemMap, err := DataSourceIbmBackupRecoveriesKubernetesRecoveryObjectParamsToMap(&objectsItem) // #nosec G601 if err != nil { return modelMap, err } @@ -5337,6 +5726,13 @@ func DataSourceIbmBackupRecoveriesRecoverKubernetesNamespaceParamsKubernetesTarg } modelMap["objects"] = objects } + if model.RecoverClusterScopedResources != nil { + recoverClusterScopedResourcesMap, err := DataSourceIbmBackupRecoveriesRecoverClusterScopedResourcesParamsToMap(model.RecoverClusterScopedResources) + if err != nil { + return modelMap, err + } + modelMap["recover_cluster_scoped_resources"] = []map[string]interface{}{recoverClusterScopedResourcesMap} + } if model.RecoverProtectionGroupRunsParams != nil { recoverProtectionGroupRunsParams := []map[string]interface{}{} for _, recoverProtectionGroupRunsParamsItem := range model.RecoverProtectionGroupRunsParams { @@ -5351,11 +5747,29 @@ func DataSourceIbmBackupRecoveriesRecoverKubernetesNamespaceParamsKubernetesTarg if model.RecoverPvcsOnly != nil { modelMap["recover_pvcs_only"] = *model.RecoverPvcsOnly } + if model.RecoveryRegionMigrationParams != nil { + recoveryRegionMigrationParamsMap, err := DataSourceIbmBackupRecoveriesKubernetesRecoveryMigrationParamsToMap(model.RecoveryRegionMigrationParams) + if err != nil { + return modelMap, err + } + modelMap["recovery_region_migration_params"] = []map[string]interface{}{recoveryRegionMigrationParamsMap} + } recoveryTargetConfigMap, err := DataSourceIbmBackupRecoveriesKubernetesTargetParamsForRecoverKubernetesNamespaceRecoveryTargetConfigToMap(model.RecoveryTargetConfig) if err != nil { return modelMap, err } modelMap["recovery_target_config"] = []map[string]interface{}{recoveryTargetConfigMap} + if model.RecoveryZoneMigrationParams != nil { + recoveryZoneMigrationParams := []map[string]interface{}{} + for _, recoveryZoneMigrationParamsItem := range model.RecoveryZoneMigrationParams { + recoveryZoneMigrationParamsItemMap, err := DataSourceIbmBackupRecoveriesKubernetesRecoveryMigrationParamsToMap(&recoveryZoneMigrationParamsItem) // #nosec G601 + if err != nil { + return modelMap, err + } + recoveryZoneMigrationParams = append(recoveryZoneMigrationParams, recoveryZoneMigrationParamsItemMap) + } + modelMap["recovery_zone_migration_params"] = recoveryZoneMigrationParams + } if model.RenameRecoveredNamespacesParams != nil { renameRecoveredNamespacesParamsMap, err := DataSourceIbmBackupRecoveriesKubernetesTargetParamsForRecoverKubernetesNamespaceRenameRecoveredNamespacesParamsToMap(model.RenameRecoveredNamespacesParams) if err != nil { @@ -5395,6 +5809,17 @@ func DataSourceIbmBackupRecoveriesKubernetesFilterParamsToMap(model *backuprecov if model.Objects != nil { modelMap["objects"] = model.Objects } + if model.SelectedResources != nil { + selectedResources := []map[string]interface{}{} + for _, selectedResourcesItem := range model.SelectedResources { + selectedResourcesItemMap, err := DataSourceIbmBackupRecoveriesResourceInfoToMap(&selectedResourcesItem) // #nosec G601 + if err != nil { + return modelMap, err + } + selectedResources = append(selectedResources, selectedResourcesItemMap) + } + modelMap["selected_resources"] = selectedResources + } return modelMap, nil } @@ -5409,6 +5834,48 @@ func DataSourceIbmBackupRecoveriesKubernetesLabelToMap(model *backuprecoveryv1.K return modelMap, nil } +func DataSourceIbmBackupRecoveriesResourceInfoToMap(model *backuprecoveryv1.ResourceInfo) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.ApiGroup != nil { + modelMap["api_group"] = *model.ApiGroup + } + if model.IsClusterScoped != nil { + modelMap["is_cluster_scoped"] = *model.IsClusterScoped + } + if model.Kind != nil { + modelMap["kind"] = *model.Kind + } + if model.Name != nil { + modelMap["name"] = *model.Name + } + if model.ResourceList != nil { + resourceList := []map[string]interface{}{} + for _, resourceListItem := range model.ResourceList { + resourceListItemMap, err := DataSourceIbmBackupRecoveriesResourceInstanceToMap(&resourceListItem) // #nosec G601 + if err != nil { + return modelMap, err + } + resourceList = append(resourceList, resourceListItemMap) + } + modelMap["resource_list"] = resourceList + } + if model.Version != nil { + modelMap["version"] = *model.Version + } + return modelMap, nil +} + +func DataSourceIbmBackupRecoveriesResourceInstanceToMap(model *backuprecoveryv1.ResourceInstance) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.EntityID != nil { + modelMap["entity_id"] = flex.IntValue(model.EntityID) + } + if model.Name != nil { + modelMap["name"] = *model.Name + } + return modelMap, nil +} + func DataSourceIbmBackupRecoveriesKubernetesPvcInfoToMap(model *backuprecoveryv1.KubernetesPvcInfo) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.ID != nil { @@ -5420,6 +5887,97 @@ func DataSourceIbmBackupRecoveriesKubernetesPvcInfoToMap(model *backuprecoveryv1 return modelMap, nil } +func DataSourceIbmBackupRecoveriesKubernetesRecoveryObjectParamsToMap(model *backuprecoveryv1.KubernetesRecoveryObjectParams) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["snapshot_id"] = *model.SnapshotID + if model.PointInTimeUsecs != nil { + modelMap["point_in_time_usecs"] = flex.IntValue(model.PointInTimeUsecs) + } + if model.ProtectionGroupID != nil { + modelMap["protection_group_id"] = *model.ProtectionGroupID + } + if model.ProtectionGroupName != nil { + modelMap["protection_group_name"] = *model.ProtectionGroupName + } + if model.SnapshotCreationTimeUsecs != nil { + modelMap["snapshot_creation_time_usecs"] = flex.IntValue(model.SnapshotCreationTimeUsecs) + } + if model.ObjectInfo != nil { + objectInfoMap, err := DataSourceIbmBackupRecoveriesCommonRecoverObjectSnapshotParamsObjectInfoToMap(model.ObjectInfo) + if err != nil { + return modelMap, err + } + modelMap["object_info"] = []map[string]interface{}{objectInfoMap} + } + if model.SnapshotTargetType != nil { + modelMap["snapshot_target_type"] = *model.SnapshotTargetType + } + if model.ArchivalTargetInfo != nil { + archivalTargetInfoMap, err := DataSourceIbmBackupRecoveriesCommonRecoverObjectSnapshotParamsArchivalTargetInfoToMap(model.ArchivalTargetInfo) + if err != nil { + return modelMap, err + } + modelMap["archival_target_info"] = []map[string]interface{}{archivalTargetInfoMap} + } + if model.ProgressTaskID != nil { + modelMap["progress_task_id"] = *model.ProgressTaskID + } + if model.RecoverFromStandby != nil { + modelMap["recover_from_standby"] = *model.RecoverFromStandby + } + if model.Status != nil { + modelMap["status"] = *model.Status + } + if model.StartTimeUsecs != nil { + modelMap["start_time_usecs"] = flex.IntValue(model.StartTimeUsecs) + } + if model.EndTimeUsecs != nil { + modelMap["end_time_usecs"] = flex.IntValue(model.EndTimeUsecs) + } + if model.Messages != nil { + modelMap["messages"] = model.Messages + } + if model.BytesRestored != nil { + modelMap["bytes_restored"] = flex.IntValue(model.BytesRestored) + } + if model.ExcludeParams != nil { + excludeParamsMap, err := DataSourceIbmBackupRecoveriesKubernetesFilterParamsToMap(model.ExcludeParams) + if err != nil { + return modelMap, err + } + modelMap["exclude_params"] = []map[string]interface{}{excludeParamsMap} + } + if model.IncludeParams != nil { + includeParamsMap, err := DataSourceIbmBackupRecoveriesKubernetesFilterParamsToMap(model.IncludeParams) + if err != nil { + return modelMap, err + } + modelMap["include_params"] = []map[string]interface{}{includeParamsMap} + } + if model.RecoverPvcsOnly != nil { + modelMap["recover_pvcs_only"] = *model.RecoverPvcsOnly + } + if model.StorageClass != nil { + storageClassMap, err := DataSourceIbmBackupRecoveriesKubernetesStorageClassParamsToMap(model.StorageClass) + if err != nil { + return modelMap, err + } + modelMap["storage_class"] = []map[string]interface{}{storageClassMap} + } + if model.UnbindPvcs != nil { + modelMap["unbind_pvcs"] = *model.UnbindPvcs + } + return modelMap, nil +} + +func DataSourceIbmBackupRecoveriesRecoverClusterScopedResourcesParamsToMap(model *backuprecoveryv1.RecoverClusterScopedResourcesParams) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.SnapshotID != nil { + modelMap["snapshot_id"] = *model.SnapshotID + } + return modelMap, nil +} + func DataSourceIbmBackupRecoveriesRecoverProtectionGroupRunParamsToMap(model *backuprecoveryv1.RecoverProtectionGroupRunParams) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.ArchivalTargetID != nil { @@ -5433,6 +5991,13 @@ func DataSourceIbmBackupRecoveriesRecoverProtectionGroupRunParamsToMap(model *ba return modelMap, nil } +func DataSourceIbmBackupRecoveriesKubernetesRecoveryMigrationParamsToMap(model *backuprecoveryv1.KubernetesRecoveryMigrationParams) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["current_value"] = *model.CurrentValue + modelMap["new_value"] = *model.NewValue + return modelMap, nil +} + func DataSourceIbmBackupRecoveriesKubernetesTargetParamsForRecoverKubernetesNamespaceRecoveryTargetConfigToMap(model *backuprecoveryv1.KubernetesTargetParamsForRecoverKubernetesNamespaceRecoveryTargetConfig) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.NewSourceConfig != nil { diff --git a/ibm/service/backuprecovery/data_source_ibm_backup_recovery.go b/ibm/service/backuprecovery/data_source_ibm_backup_recovery.go index 5c0b42f0ab..d3bb956266 100644 --- a/ibm/service/backuprecovery/data_source_ibm_backup_recovery.go +++ b/ibm/service/backuprecovery/data_source_ibm_backup_recovery.go @@ -2215,13 +2215,66 @@ func DataSourceIbmBackupRecovery() *schema.Resource { Type: schema.TypeInt, }, }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, }, }, }, "excluded_pvcs": &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: "Specifies the list of pvc to be excluded from recovery.", + Description: "Specifies the list of pvc to be excluded from recovery. This will be deprecated in the future. This is overridden by the object level param.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": &schema.Schema{ @@ -2275,6 +2328,59 @@ func DataSourceIbmBackupRecovery() *schema.Resource { Type: schema.TypeInt, }, }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, }, }, }, @@ -2768,6 +2874,251 @@ func DataSourceIbmBackupRecovery() *schema.Resource { Computed: true, Description: "Specify the total bytes restored.", }, + "exclude_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the parameters to in/exclude objects (e.g.: volumes). An object satisfying any of these criteria will be included by this filter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "label_combination_method": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Whether to include all the labels or any of them while performing inclusion/exclusion of objects.", + }, + "label_vector": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object to represent Label that Specify Objects (e.g.: Persistent Volumes and Persistent Volume Claims) to Include or Exclude.It will be a two-dimensional array, where each inner array will consist of a key and value representing labels. Using this two dimensional array of Labels, the Cluster generates a list of items to include in the filter, which are derived from intersections or the union of these labels, as decided by operation parameter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The key of the label, used to identify the label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The value associated with the label key.", + }, + }, + }, + }, + "objects": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of objects that are to be included.", + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, + }, + }, + }, + "include_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the parameters to in/exclude objects (e.g.: volumes). An object satisfying any of these criteria will be included by this filter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "label_combination_method": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Whether to include all the labels or any of them while performing inclusion/exclusion of objects.", + }, + "label_vector": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object to represent Label that Specify Objects (e.g.: Persistent Volumes and Persistent Volume Claims) to Include or Exclude.It will be a two-dimensional array, where each inner array will consist of a key and value representing labels. Using this two dimensional array of Labels, the Cluster generates a list of items to include in the filter, which are derived from intersections or the union of these labels, as decided by operation parameter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The key of the label, used to identify the label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The value associated with the label key.", + }, + }, + }, + }, + "objects": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of objects that are to be included.", + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, + }, + }, + }, + "recover_pvcs_only": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether to recover PVCs only during recovery. Default: false.", + }, + "storage_class": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the storage class parameters for recovery of namespace.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "storage_class_mapping": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies mapping of storage classes.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The key of the label, used to identify the label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The value associated with the label key.", + }, + }, + }, + }, + "use_storage_class_mapping": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether or not to use storage class mapping.", + }, + }, + }, + }, + "unbind_pvcs": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether the volume bindings will be removed from all restored PVCs. This will effectively unbind the PVCs from their original PVs. Default: false.", + }, + }, + }, + }, + "recover_cluster_scoped_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the parameters from where the cluster scoped resources would be recovered.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "snapshot_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the snapshot id of the namespace from where the cluster scoped resources are to be recovered.", + }, }, }, }, @@ -2803,7 +3154,26 @@ func DataSourceIbmBackupRecovery() *schema.Resource { "recover_pvcs_only": &schema.Schema{ Type: schema.TypeBool, Computed: true, - Description: "Specifies whether to recover PVCs only during recovery.", + Description: "Specifies whether to recover PVCs only during recovery.. This is overridden with the object level settings and will be deprecated in the future.", + }, + "recovery_region_migration_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies an individual migration rule for mapping a region/zone to another for cross region recovery.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "current_value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the current value for the mapping that needs to be mutated.", + }, + "new_value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the new value for the mapping with which the fields need to be updated with.", + }, + }, + }, }, "recovery_target_config": &schema.Schema{ Type: schema.TypeList, @@ -2847,6 +3217,25 @@ func DataSourceIbmBackupRecovery() *schema.Resource { }, }, }, + "recovery_zone_migration_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies rules for performing zone migrations during recovery. Used in case of recovery to new location and the namespace being recovered is in a different zone.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "current_value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the current value for the mapping that needs to be mutated.", + }, + "new_value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the new value for the mapping with which the fields need to be updated with.", + }, + }, + }, + }, "rename_recovered_namespaces_params": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -5246,7 +5635,7 @@ func DataSourceIbmBackupRecoveryRecoverKubernetesNamespaceParamsKubernetesTarget if model.Objects != nil { objects := []map[string]interface{}{} for _, objectsItem := range model.Objects { - objectsItemMap, err := DataSourceIbmBackupRecoveryCommonRecoverObjectSnapshotParamsToMap(&objectsItem) // #nosec G601 + objectsItemMap, err := DataSourceIbmBackupRecoveryKubernetesRecoveryObjectParamsToMap(&objectsItem) // #nosec G601 if err != nil { return modelMap, err } @@ -5254,6 +5643,13 @@ func DataSourceIbmBackupRecoveryRecoverKubernetesNamespaceParamsKubernetesTarget } modelMap["objects"] = objects } + if model.RecoverClusterScopedResources != nil { + recoverClusterScopedResourcesMap, err := DataSourceIbmBackupRecoveryRecoverClusterScopedResourcesParamsToMap(model.RecoverClusterScopedResources) + if err != nil { + return modelMap, err + } + modelMap["recover_cluster_scoped_resources"] = []map[string]interface{}{recoverClusterScopedResourcesMap} + } if model.RecoverProtectionGroupRunsParams != nil { recoverProtectionGroupRunsParams := []map[string]interface{}{} for _, recoverProtectionGroupRunsParamsItem := range model.RecoverProtectionGroupRunsParams { @@ -5268,11 +5664,29 @@ func DataSourceIbmBackupRecoveryRecoverKubernetesNamespaceParamsKubernetesTarget if model.RecoverPvcsOnly != nil { modelMap["recover_pvcs_only"] = *model.RecoverPvcsOnly } + if model.RecoveryRegionMigrationParams != nil { + recoveryRegionMigrationParamsMap, err := DataSourceIbmBackupRecoveryKubernetesRecoveryMigrationParamsToMap(model.RecoveryRegionMigrationParams) + if err != nil { + return modelMap, err + } + modelMap["recovery_region_migration_params"] = []map[string]interface{}{recoveryRegionMigrationParamsMap} + } recoveryTargetConfigMap, err := DataSourceIbmBackupRecoveryKubernetesTargetParamsForRecoverKubernetesNamespaceRecoveryTargetConfigToMap(model.RecoveryTargetConfig) if err != nil { return modelMap, err } modelMap["recovery_target_config"] = []map[string]interface{}{recoveryTargetConfigMap} + if model.RecoveryZoneMigrationParams != nil { + recoveryZoneMigrationParams := []map[string]interface{}{} + for _, recoveryZoneMigrationParamsItem := range model.RecoveryZoneMigrationParams { + recoveryZoneMigrationParamsItemMap, err := DataSourceIbmBackupRecoveryKubernetesRecoveryMigrationParamsToMap(&recoveryZoneMigrationParamsItem) // #nosec G601 + if err != nil { + return modelMap, err + } + recoveryZoneMigrationParams = append(recoveryZoneMigrationParams, recoveryZoneMigrationParamsItemMap) + } + modelMap["recovery_zone_migration_params"] = recoveryZoneMigrationParams + } if model.RenameRecoveredNamespacesParams != nil { renameRecoveredNamespacesParamsMap, err := DataSourceIbmBackupRecoveryKubernetesTargetParamsForRecoverKubernetesNamespaceRenameRecoveredNamespacesParamsToMap(model.RenameRecoveredNamespacesParams) if err != nil { @@ -5312,6 +5726,17 @@ func DataSourceIbmBackupRecoveryKubernetesFilterParamsToMap(model *backuprecover if model.Objects != nil { modelMap["objects"] = model.Objects } + if model.SelectedResources != nil { + selectedResources := []map[string]interface{}{} + for _, selectedResourcesItem := range model.SelectedResources { + selectedResourcesItemMap, err := DataSourceIbmBackupRecoveryResourceInfoToMap(&selectedResourcesItem) // #nosec G601 + if err != nil { + return modelMap, err + } + selectedResources = append(selectedResources, selectedResourcesItemMap) + } + modelMap["selected_resources"] = selectedResources + } return modelMap, nil } @@ -5326,6 +5751,48 @@ func DataSourceIbmBackupRecoveryKubernetesLabelToMap(model *backuprecoveryv1.Kub return modelMap, nil } +func DataSourceIbmBackupRecoveryResourceInfoToMap(model *backuprecoveryv1.ResourceInfo) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.ApiGroup != nil { + modelMap["api_group"] = *model.ApiGroup + } + if model.IsClusterScoped != nil { + modelMap["is_cluster_scoped"] = *model.IsClusterScoped + } + if model.Kind != nil { + modelMap["kind"] = *model.Kind + } + if model.Name != nil { + modelMap["name"] = *model.Name + } + if model.ResourceList != nil { + resourceList := []map[string]interface{}{} + for _, resourceListItem := range model.ResourceList { + resourceListItemMap, err := DataSourceIbmBackupRecoveryResourceInstanceToMap(&resourceListItem) // #nosec G601 + if err != nil { + return modelMap, err + } + resourceList = append(resourceList, resourceListItemMap) + } + modelMap["resource_list"] = resourceList + } + if model.Version != nil { + modelMap["version"] = *model.Version + } + return modelMap, nil +} + +func DataSourceIbmBackupRecoveryResourceInstanceToMap(model *backuprecoveryv1.ResourceInstance) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.EntityID != nil { + modelMap["entity_id"] = flex.IntValue(model.EntityID) + } + if model.Name != nil { + modelMap["name"] = *model.Name + } + return modelMap, nil +} + func DataSourceIbmBackupRecoveryKubernetesPvcInfoToMap(model *backuprecoveryv1.KubernetesPvcInfo) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.ID != nil { @@ -5337,6 +5804,97 @@ func DataSourceIbmBackupRecoveryKubernetesPvcInfoToMap(model *backuprecoveryv1.K return modelMap, nil } +func DataSourceIbmBackupRecoveryKubernetesRecoveryObjectParamsToMap(model *backuprecoveryv1.KubernetesRecoveryObjectParams) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["snapshot_id"] = *model.SnapshotID + if model.PointInTimeUsecs != nil { + modelMap["point_in_time_usecs"] = flex.IntValue(model.PointInTimeUsecs) + } + if model.ProtectionGroupID != nil { + modelMap["protection_group_id"] = *model.ProtectionGroupID + } + if model.ProtectionGroupName != nil { + modelMap["protection_group_name"] = *model.ProtectionGroupName + } + if model.SnapshotCreationTimeUsecs != nil { + modelMap["snapshot_creation_time_usecs"] = flex.IntValue(model.SnapshotCreationTimeUsecs) + } + if model.ObjectInfo != nil { + objectInfoMap, err := DataSourceIbmBackupRecoveryCommonRecoverObjectSnapshotParamsObjectInfoToMap(model.ObjectInfo) + if err != nil { + return modelMap, err + } + modelMap["object_info"] = []map[string]interface{}{objectInfoMap} + } + if model.SnapshotTargetType != nil { + modelMap["snapshot_target_type"] = *model.SnapshotTargetType + } + if model.ArchivalTargetInfo != nil { + archivalTargetInfoMap, err := DataSourceIbmBackupRecoveryCommonRecoverObjectSnapshotParamsArchivalTargetInfoToMap(model.ArchivalTargetInfo) + if err != nil { + return modelMap, err + } + modelMap["archival_target_info"] = []map[string]interface{}{archivalTargetInfoMap} + } + if model.ProgressTaskID != nil { + modelMap["progress_task_id"] = *model.ProgressTaskID + } + if model.RecoverFromStandby != nil { + modelMap["recover_from_standby"] = *model.RecoverFromStandby + } + if model.Status != nil { + modelMap["status"] = *model.Status + } + if model.StartTimeUsecs != nil { + modelMap["start_time_usecs"] = flex.IntValue(model.StartTimeUsecs) + } + if model.EndTimeUsecs != nil { + modelMap["end_time_usecs"] = flex.IntValue(model.EndTimeUsecs) + } + if model.Messages != nil { + modelMap["messages"] = model.Messages + } + if model.BytesRestored != nil { + modelMap["bytes_restored"] = flex.IntValue(model.BytesRestored) + } + if model.ExcludeParams != nil { + excludeParamsMap, err := DataSourceIbmBackupRecoveryKubernetesFilterParamsToMap(model.ExcludeParams) + if err != nil { + return modelMap, err + } + modelMap["exclude_params"] = []map[string]interface{}{excludeParamsMap} + } + if model.IncludeParams != nil { + includeParamsMap, err := DataSourceIbmBackupRecoveryKubernetesFilterParamsToMap(model.IncludeParams) + if err != nil { + return modelMap, err + } + modelMap["include_params"] = []map[string]interface{}{includeParamsMap} + } + if model.RecoverPvcsOnly != nil { + modelMap["recover_pvcs_only"] = *model.RecoverPvcsOnly + } + if model.StorageClass != nil { + storageClassMap, err := DataSourceIbmBackupRecoveryKubernetesStorageClassParamsToMap(model.StorageClass) + if err != nil { + return modelMap, err + } + modelMap["storage_class"] = []map[string]interface{}{storageClassMap} + } + if model.UnbindPvcs != nil { + modelMap["unbind_pvcs"] = *model.UnbindPvcs + } + return modelMap, nil +} + +func DataSourceIbmBackupRecoveryRecoverClusterScopedResourcesParamsToMap(model *backuprecoveryv1.RecoverClusterScopedResourcesParams) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.SnapshotID != nil { + modelMap["snapshot_id"] = *model.SnapshotID + } + return modelMap, nil +} + func DataSourceIbmBackupRecoveryRecoverProtectionGroupRunParamsToMap(model *backuprecoveryv1.RecoverProtectionGroupRunParams) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.ArchivalTargetID != nil { @@ -5350,6 +5908,13 @@ func DataSourceIbmBackupRecoveryRecoverProtectionGroupRunParamsToMap(model *back return modelMap, nil } +func DataSourceIbmBackupRecoveryKubernetesRecoveryMigrationParamsToMap(model *backuprecoveryv1.KubernetesRecoveryMigrationParams) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["current_value"] = *model.CurrentValue + modelMap["new_value"] = *model.NewValue + return modelMap, nil +} + func DataSourceIbmBackupRecoveryKubernetesTargetParamsForRecoverKubernetesNamespaceRecoveryTargetConfigToMap(model *backuprecoveryv1.KubernetesTargetParamsForRecoverKubernetesNamespaceRecoveryTargetConfig) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.NewSourceConfig != nil { diff --git a/ibm/service/backuprecovery/data_source_ibm_backup_recovery_protection_group.go b/ibm/service/backuprecovery/data_source_ibm_backup_recovery_protection_group.go index 1987a5fb56..7fcd49c5ac 100644 --- a/ibm/service/backuprecovery/data_source_ibm_backup_recovery_protection_group.go +++ b/ibm/service/backuprecovery/data_source_ibm_backup_recovery_protection_group.go @@ -4695,6 +4695,59 @@ func DataSourceIbmBackupRecoveryProtectionGroup() *schema.Resource { Type: schema.TypeInt, }, }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, }, }, }, @@ -4736,6 +4789,59 @@ func DataSourceIbmBackupRecoveryProtectionGroup() *schema.Resource { Type: schema.TypeInt, }, }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, }, }, }, @@ -4768,6 +4874,100 @@ func DataSourceIbmBackupRecoveryProtectionGroup() *schema.Resource { Computed: true, Description: "Specifies whether to backup pvc and related resources only.", }, + "exclude_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the parameters to in/exclude objects (e.g.: volumes). An object satisfying any of these criteria will be included by this filter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "label_combination_method": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Whether to include all the labels or any of them while performing inclusion/exclusion of objects.", + }, + "label_vector": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object to represent Label that Specify Objects (e.g.: Persistent Volumes and Persistent Volume Claims) to Include or Exclude.It will be a two-dimensional array, where each inner array will consist of a key and value representing labels. Using this two dimensional array of Labels, the Cluster generates a list of items to include in the filter, which are derived from intersections or the union of these labels, as decided by operation parameter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The key of the label, used to identify the label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The value associated with the label key.", + }, + }, + }, + }, + "objects": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of objects that are to be included.", + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, + }, + }, + }, "exclude_pvcs": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -4795,11 +4995,110 @@ func DataSourceIbmBackupRecoveryProtectionGroup() *schema.Resource { Type: schema.TypeString, }, }, + "fail_backup_on_hook_failure": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "If true, fail backups when quiesce hook executions fail.", + }, "id": &schema.Schema{ Type: schema.TypeInt, Computed: true, Description: "Specifies the id of the object.", }, + "include_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the parameters to in/exclude objects (e.g.: volumes). An object satisfying any of these criteria will be included by this filter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "label_combination_method": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Whether to include all the labels or any of them while performing inclusion/exclusion of objects.", + }, + "label_vector": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object to represent Label that Specify Objects (e.g.: Persistent Volumes and Persistent Volume Claims) to Include or Exclude.It will be a two-dimensional array, where each inner array will consist of a key and value representing labels. Using this two dimensional array of Labels, the Cluster generates a list of items to include in the filter, which are derived from intersections or the union of these labels, as decided by operation parameter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The key of the label, used to identify the label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The value associated with the label key.", + }, + }, + }, + }, + "objects": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of objects that are to be included.", + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, + }, + }, + }, "include_pvcs": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -7441,6 +7740,17 @@ func DataSourceIbmBackupRecoveryProtectionGroupKubernetesFilterParamsToMap(model if model.Objects != nil { modelMap["objects"] = model.Objects } + if model.SelectedResources != nil { + selectedResources := []map[string]interface{}{} + for _, selectedResourcesItem := range model.SelectedResources { + selectedResourcesItemMap, err := DataSourceIbmBackupRecoveryProtectionGroupResourceInfoToMap(&selectedResourcesItem) // #nosec G601 + if err != nil { + return modelMap, err + } + selectedResources = append(selectedResources, selectedResourcesItemMap) + } + modelMap["selected_resources"] = selectedResources + } return modelMap, nil } @@ -7455,11 +7765,60 @@ func DataSourceIbmBackupRecoveryProtectionGroupKubernetesLabelToMap(model *backu return modelMap, nil } +func DataSourceIbmBackupRecoveryProtectionGroupResourceInfoToMap(model *backuprecoveryv1.ResourceInfo) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.ApiGroup != nil { + modelMap["api_group"] = *model.ApiGroup + } + if model.IsClusterScoped != nil { + modelMap["is_cluster_scoped"] = *model.IsClusterScoped + } + if model.Kind != nil { + modelMap["kind"] = *model.Kind + } + if model.Name != nil { + modelMap["name"] = *model.Name + } + if model.ResourceList != nil { + resourceList := []map[string]interface{}{} + for _, resourceListItem := range model.ResourceList { + resourceListItemMap, err := DataSourceIbmBackupRecoveryProtectionGroupResourceInstanceToMap(&resourceListItem) // #nosec G601 + if err != nil { + return modelMap, err + } + resourceList = append(resourceList, resourceListItemMap) + } + modelMap["resource_list"] = resourceList + } + if model.Version != nil { + modelMap["version"] = *model.Version + } + return modelMap, nil +} + +func DataSourceIbmBackupRecoveryProtectionGroupResourceInstanceToMap(model *backuprecoveryv1.ResourceInstance) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.EntityID != nil { + modelMap["entity_id"] = flex.IntValue(model.EntityID) + } + if model.Name != nil { + modelMap["name"] = *model.Name + } + return modelMap, nil +} + func DataSourceIbmBackupRecoveryProtectionGroupKubernetesProtectionGroupObjectParamsToMap(model *backuprecoveryv1.KubernetesProtectionGroupObjectParams) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.BackupOnlyPvc != nil { modelMap["backup_only_pvc"] = *model.BackupOnlyPvc } + if model.ExcludeParams != nil { + excludeParamsMap, err := DataSourceIbmBackupRecoveryProtectionGroupKubernetesFilterParamsToMap(model.ExcludeParams) + if err != nil { + return modelMap, err + } + modelMap["exclude_params"] = []map[string]interface{}{excludeParamsMap} + } if model.ExcludePvcs != nil { excludePvcs := []map[string]interface{}{} for _, excludePvcsItem := range model.ExcludePvcs { @@ -7474,7 +7833,17 @@ func DataSourceIbmBackupRecoveryProtectionGroupKubernetesProtectionGroupObjectPa if model.ExcludedResources != nil { modelMap["excluded_resources"] = model.ExcludedResources } + if model.FailBackupOnHookFailure != nil { + modelMap["fail_backup_on_hook_failure"] = *model.FailBackupOnHookFailure + } modelMap["id"] = flex.IntValue(model.ID) + if model.IncludeParams != nil { + includeParamsMap, err := DataSourceIbmBackupRecoveryProtectionGroupKubernetesFilterParamsToMap(model.IncludeParams) + if err != nil { + return modelMap, err + } + modelMap["include_params"] = []map[string]interface{}{includeParamsMap} + } if model.IncludePvcs != nil { includePvcs := []map[string]interface{}{} for _, includePvcsItem := range model.IncludePvcs { diff --git a/ibm/service/backuprecovery/data_source_ibm_backup_recovery_protection_groups.go b/ibm/service/backuprecovery/data_source_ibm_backup_recovery_protection_groups.go index cbf57a961c..a1d1de5865 100644 --- a/ibm/service/backuprecovery/data_source_ibm_backup_recovery_protection_groups.go +++ b/ibm/service/backuprecovery/data_source_ibm_backup_recovery_protection_groups.go @@ -4807,6 +4807,59 @@ func DataSourceIbmBackupRecoveryProtectionGroups() *schema.Resource { Type: schema.TypeInt, }, }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, }, }, }, @@ -4848,6 +4901,59 @@ func DataSourceIbmBackupRecoveryProtectionGroups() *schema.Resource { Type: schema.TypeInt, }, }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, }, }, }, @@ -4880,6 +4986,100 @@ func DataSourceIbmBackupRecoveryProtectionGroups() *schema.Resource { Computed: true, Description: "Specifies whether to backup pvc and related resources only.", }, + "exclude_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the parameters to in/exclude objects (e.g.: volumes). An object satisfying any of these criteria will be included by this filter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "label_combination_method": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Whether to include all the labels or any of them while performing inclusion/exclusion of objects.", + }, + "label_vector": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object to represent Label that Specify Objects (e.g.: Persistent Volumes and Persistent Volume Claims) to Include or Exclude.It will be a two-dimensional array, where each inner array will consist of a key and value representing labels. Using this two dimensional array of Labels, the Cluster generates a list of items to include in the filter, which are derived from intersections or the union of these labels, as decided by operation parameter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The key of the label, used to identify the label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The value associated with the label key.", + }, + }, + }, + }, + "objects": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of objects that are to be included.", + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, + }, + }, + }, "exclude_pvcs": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -4907,11 +5107,110 @@ func DataSourceIbmBackupRecoveryProtectionGroups() *schema.Resource { Type: schema.TypeString, }, }, + "fail_backup_on_hook_failure": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "If true, fail backups when quiesce hook executions fail.", + }, "id": &schema.Schema{ Type: schema.TypeInt, Computed: true, Description: "Specifies the id of the object.", }, + "include_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the parameters to in/exclude objects (e.g.: volumes). An object satisfying any of these criteria will be included by this filter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "label_combination_method": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Whether to include all the labels or any of them while performing inclusion/exclusion of objects.", + }, + "label_vector": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object to represent Label that Specify Objects (e.g.: Persistent Volumes and Persistent Volume Claims) to Include or Exclude.It will be a two-dimensional array, where each inner array will consist of a key and value representing labels. Using this two dimensional array of Labels, the Cluster generates a list of items to include in the filter, which are derived from intersections or the union of these labels, as decided by operation parameter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The key of the label, used to identify the label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The value associated with the label key.", + }, + }, + }, + }, + "objects": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of objects that are to be included.", + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, + }, + }, + }, "include_pvcs": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -7579,6 +7878,17 @@ func DataSourceIbmBackupRecoveryProtectionGroupsKubernetesFilterParamsToMap(mode if model.Objects != nil { modelMap["objects"] = model.Objects } + if model.SelectedResources != nil { + selectedResources := []map[string]interface{}{} + for _, selectedResourcesItem := range model.SelectedResources { + selectedResourcesItemMap, err := DataSourceIbmBackupRecoveryProtectionGroupsResourceInfoToMap(&selectedResourcesItem) // #nosec G601 + if err != nil { + return modelMap, err + } + selectedResources = append(selectedResources, selectedResourcesItemMap) + } + modelMap["selected_resources"] = selectedResources + } return modelMap, nil } @@ -7593,11 +7903,60 @@ func DataSourceIbmBackupRecoveryProtectionGroupsKubernetesLabelToMap(model *back return modelMap, nil } +func DataSourceIbmBackupRecoveryProtectionGroupsResourceInfoToMap(model *backuprecoveryv1.ResourceInfo) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.ApiGroup != nil { + modelMap["api_group"] = *model.ApiGroup + } + if model.IsClusterScoped != nil { + modelMap["is_cluster_scoped"] = *model.IsClusterScoped + } + if model.Kind != nil { + modelMap["kind"] = *model.Kind + } + if model.Name != nil { + modelMap["name"] = *model.Name + } + if model.ResourceList != nil { + resourceList := []map[string]interface{}{} + for _, resourceListItem := range model.ResourceList { + resourceListItemMap, err := DataSourceIbmBackupRecoveryProtectionGroupsResourceInstanceToMap(&resourceListItem) // #nosec G601 + if err != nil { + return modelMap, err + } + resourceList = append(resourceList, resourceListItemMap) + } + modelMap["resource_list"] = resourceList + } + if model.Version != nil { + modelMap["version"] = *model.Version + } + return modelMap, nil +} + +func DataSourceIbmBackupRecoveryProtectionGroupsResourceInstanceToMap(model *backuprecoveryv1.ResourceInstance) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.EntityID != nil { + modelMap["entity_id"] = flex.IntValue(model.EntityID) + } + if model.Name != nil { + modelMap["name"] = *model.Name + } + return modelMap, nil +} + func DataSourceIbmBackupRecoveryProtectionGroupsKubernetesProtectionGroupObjectParamsToMap(model *backuprecoveryv1.KubernetesProtectionGroupObjectParams) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.BackupOnlyPvc != nil { modelMap["backup_only_pvc"] = *model.BackupOnlyPvc } + if model.ExcludeParams != nil { + excludeParamsMap, err := DataSourceIbmBackupRecoveryProtectionGroupsKubernetesFilterParamsToMap(model.ExcludeParams) + if err != nil { + return modelMap, err + } + modelMap["exclude_params"] = []map[string]interface{}{excludeParamsMap} + } if model.ExcludePvcs != nil { excludePvcs := []map[string]interface{}{} for _, excludePvcsItem := range model.ExcludePvcs { @@ -7612,7 +7971,17 @@ func DataSourceIbmBackupRecoveryProtectionGroupsKubernetesProtectionGroupObjectP if model.ExcludedResources != nil { modelMap["excluded_resources"] = model.ExcludedResources } + if model.FailBackupOnHookFailure != nil { + modelMap["fail_backup_on_hook_failure"] = *model.FailBackupOnHookFailure + } modelMap["id"] = flex.IntValue(model.ID) + if model.IncludeParams != nil { + includeParamsMap, err := DataSourceIbmBackupRecoveryProtectionGroupsKubernetesFilterParamsToMap(model.IncludeParams) + if err != nil { + return modelMap, err + } + modelMap["include_params"] = []map[string]interface{}{includeParamsMap} + } if model.IncludePvcs != nil { includePvcs := []map[string]interface{}{} for _, includePvcsItem := range model.IncludePvcs { diff --git a/ibm/service/backuprecovery/data_source_ibm_backup_recovery_protection_sources.go b/ibm/service/backuprecovery/data_source_ibm_backup_recovery_protection_sources.go index cca7d86008..9c4d8d458e 100644 --- a/ibm/service/backuprecovery/data_source_ibm_backup_recovery_protection_sources.go +++ b/ibm/service/backuprecovery/data_source_ibm_backup_recovery_protection_sources.go @@ -1815,6 +1815,267 @@ func DataSourceIbmBackupRecoveryProtectionSources() *schema.Resource { }, }, }, + "kubernetes_protection_source": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies a Protection Source in Kubernetes environment.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "datamover_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of Datamover image in private registry.", + }, + "datamover_service_type": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies Type of service to be deployed for communication with DataMover pods. Currently, LoadBalancer and NodePort are supported. [default = kNodePort].", + }, + "datamover_upgradability": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies if the deployed Datamover image needs to be upgraded for this kubernetes entity.", + }, + "default_vlan_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN parameters for the restore operation.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "disable_vlan": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether to use the VIPs even when VLANs are configured on the Cluster. If configured, VLAN IP addresses are used by default. If VLANs are not configured, this flag is ignored. Set this flag to true to force using the partition VIPs when VLANs are configured on the Cluster.", + }, + "interface_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the physical interface group name to use for mounting Cohesity's view on the remote host. If specified, Cohesity hostname or the IP address on this VLAN is used.", + }, + "vlan": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the VLAN to use for mounting Cohesity's view on the remote host. If specified, Cohesity hostname or the IP address on this VLAN is used.", + }, + }, + }, + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies an optional description of the object.", + }, + "distribution": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the type of the entity in a Kubernetes environment. Determines the K8s distribution. kIKS, kROKS.", + }, + "init_container_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of the image for init containers.", + }, + "label_attributes": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the list of label attributes of this source.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the Cohesity id of the K8s label.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the appended key and value of the K8s label.", + }, + "uuid": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies Kubernetes Unique Identifier (UUID) of the K8s label.", + }, + }, + }, + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies a unique name of the Protection Source.", + }, + "priority_class_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the pritority class name during registration.", + }, + "resource_annotation_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies resource Annotations information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Key for label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Value for label.", + }, + }, + }, + }, + "resource_label_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies resource labels information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Key for label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Value for label.", + }, + }, + }, + }, + "san_field": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the SAN field for agent certificate.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "service_annotations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies annotations to be put on services for IP allocation. Applicable only when service is of type LoadBalancer.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "storage_class": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies storage class information of source.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies name of storage class.", + }, + "provisioner": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "specifies provisioner of storage class.", + }, + }, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the type of the entity in a Kubernetes environment. Specifies the type of a Kubernetes Protection Source. 'kCluster' indicates a Kubernetes Cluster. 'kNamespace' indicates a namespace in a Kubernetes Cluster. 'kService' indicates a service running on a Kubernetes Cluster.", + }, + "uuid": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the UUID of the object.", + }, + "velero_aws_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of Velero AWS plugin image in private registry.", + }, + "velero_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of Velero image in private registry.", + }, + "velero_openshift_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of the image for openshift plugin container.", + }, + "velero_upgradability": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies if the deployed Velero image needs to be upgraded for this kubernetes entity.", + }, + "vlan_info_vec": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "service_annotations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies annotations to be put on services for IP allocation. Applicable only when service is of type LoadBalancer.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the service annotation key value.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the service annotation value.", + }, + }, + }, + }, + "vlan_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN params associated with the backup/restore operation.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "disable_vlan": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "If this is set to true, then even if VLANs are configured on the system, the partition VIPs will be used for the restore.", + }, + "interface_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Interface group to use for backup/restore. If this is not specified, primary interface group for the cluster will be used.", + }, + "vlan_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "If this is set, then the Cohesity host name or the IP address associated with this VLAN is used for mounting Cohesity's view on the remote host.", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, "sql_protection_source": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -4717,109 +4978,370 @@ func DataSourceIbmBackupRecoveryProtectionSources() *schema.Resource { }, }, }, - "sql_protection_source": &schema.Schema{ + "kubernetes_protection_source": &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: "Specifies an Object representing one SQL Server instance or database.", + Description: "Specifies a Protection Source in Kubernetes environment.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "is_available_for_vss_backup": &schema.Schema{ - Type: schema.TypeBool, - Computed: true, - Description: "Specifies whether the database is marked as available for backup according to the SQL Server VSS writer. This may be false if either the state of the databases is not online, or if the VSS writer is not online. This field is set only for type 'kDatabase'.", - }, - "created_timestamp": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "Specifies the time when the database was created. It is displayed in the timezone of the SQL server on which this database is running.", - }, - "database_name": &schema.Schema{ + "datamover_image_location": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the database name of the SQL Protection Source, if the type is database.", + Description: "Specifies the location of Datamover image in private registry.", }, - "db_aag_entity_id": &schema.Schema{ + "datamover_service_type": &schema.Schema{ Type: schema.TypeInt, Computed: true, - Description: "Specifies the AAG entity id if the database is part of an AAG. This field is set only for type 'kDatabase'.", + Description: "Specifies Type of service to be deployed for communication with DataMover pods. Currently, LoadBalancer and NodePort are supported. [default = kNodePort].", }, - "db_aag_name": &schema.Schema{ + "datamover_upgradability": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the name of the AAG if the database is part of an AAG. This field is set only for type 'kDatabase'.", - }, - "db_compatibility_level": &schema.Schema{ - Type: schema.TypeInt, - Computed: true, - Description: "Specifies the versions of SQL server that the database is compatible with.", - }, - "db_file_groups": &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: "Specifies the information about the set of file groups for this db on the host. This is only set if the type is kDatabase.", - Elem: &schema.Schema{ - Type: schema.TypeString, - }, + Description: "Specifies if the deployed Datamover image needs to be upgraded for this kubernetes entity.", }, - "db_files": &schema.Schema{ + "default_vlan_params": &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: "Specifies the last known information about the set of database files on the host. This field is set only for type 'kDatabase'.", + Description: "Specifies VLAN parameters for the restore operation.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "file_type": &schema.Schema{ - Type: schema.TypeString, + "disable_vlan": &schema.Schema{ + Type: schema.TypeBool, Computed: true, - Description: "Specifies the format type of the file that SQL database stores the data. Specifies the format type of the file that SQL database stores the data. 'kRows' refers to a data file 'kLog' refers to a log file 'kFileStream' refers to a directory containing FILESTREAM data 'kNotSupportedType' is for information purposes only. Not supported. 'kFullText' refers to a full-text catalog.", + Description: "Specifies whether to use the VIPs even when VLANs are configured on the Cluster. If configured, VLAN IP addresses are used by default. If VLANs are not configured, this flag is ignored. Set this flag to true to force using the partition VIPs when VLANs are configured on the Cluster.", }, - "full_path": &schema.Schema{ + "interface_name": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the full path of the database file on the SQL host machine.", + Description: "Specifies the physical interface group name to use for mounting Cohesity's view on the remote host. If specified, Cohesity hostname or the IP address on this VLAN is used.", }, - "size_bytes": &schema.Schema{ + "vlan": &schema.Schema{ Type: schema.TypeInt, Computed: true, - Description: "Specifies the last known size of the database file.", + Description: "Specifies the VLAN to use for mounting Cohesity's view on the remote host. If specified, Cohesity hostname or the IP address on this VLAN is used.", }, }, }, }, - "db_owner_username": &schema.Schema{ + "description": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the name of the database owner.", + Description: "Specifies an optional description of the object.", }, - "default_database_location": &schema.Schema{ + "distribution": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the default path for data files for DBs in an instance.", + Description: "Specifies the type of the entity in a Kubernetes environment. Determines the K8s distribution. kIKS, kROKS.", }, - "default_log_location": &schema.Schema{ + "init_container_image_location": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the default path for log files for DBs in an instance.", + Description: "Specifies the location of the image for init containers.", }, - "id": &schema.Schema{ + "label_attributes": &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: "Specifies a unique id for a SQL Protection Source.", + Description: "Specifies the list of label attributes of this source.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "created_date_msecs": &schema.Schema{ + "id": &schema.Schema{ Type: schema.TypeInt, Computed: true, - Description: "Specifies a unique identifier generated from the date the database is created or renamed. Cohesity uses this identifier in combination with the databaseId to uniquely identify a database.", + Description: "Specifies the Cohesity id of the K8s label.", }, - "database_id": &schema.Schema{ - Type: schema.TypeInt, + "name": &schema.Schema{ + Type: schema.TypeString, Computed: true, - Description: "Specifies a unique id of the database but only for the life of the database. SQL Server may reuse database ids. Cohesity uses the createDateMsecs in combination with this databaseId to uniquely identify a database.", + Description: "Specifies the appended key and value of the K8s label.", }, - "instance_id": &schema.Schema{ + "uuid": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies unique id for the SQL Server instance. This id does not change during the life of the instance.", + Description: "Specifies Kubernetes Unique Identifier (UUID) of the K8s label.", + }, + }, + }, + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies a unique name of the Protection Source.", + }, + "priority_class_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the pritority class name during registration.", + }, + "resource_annotation_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies resource Annotations information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Key for label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Value for label.", + }, + }, + }, + }, + "resource_label_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies resource labels information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Key for label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Value for label.", + }, + }, + }, + }, + "san_field": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the SAN field for agent certificate.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "service_annotations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies annotations to be put on services for IP allocation. Applicable only when service is of type LoadBalancer.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "storage_class": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies storage class information of source.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies name of storage class.", + }, + "provisioner": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "specifies provisioner of storage class.", + }, + }, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the type of the entity in a Kubernetes environment. Specifies the type of a Kubernetes Protection Source. 'kCluster' indicates a Kubernetes Cluster. 'kNamespace' indicates a namespace in a Kubernetes Cluster. 'kService' indicates a service running on a Kubernetes Cluster.", + }, + "uuid": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the UUID of the object.", + }, + "velero_aws_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of Velero AWS plugin image in private registry.", + }, + "velero_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of Velero image in private registry.", + }, + "velero_openshift_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of the image for openshift plugin container.", + }, + "velero_upgradability": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies if the deployed Velero image needs to be upgraded for this kubernetes entity.", + }, + "vlan_info_vec": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "service_annotations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies annotations to be put on services for IP allocation. Applicable only when service is of type LoadBalancer.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the service annotation key value.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the service annotation value.", + }, + }, + }, + }, + "vlan_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN params associated with the backup/restore operation.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "disable_vlan": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "If this is set to true, then even if VLANs are configured on the system, the partition VIPs will be used for the restore.", + }, + "interface_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Interface group to use for backup/restore. If this is not specified, primary interface group for the cluster will be used.", + }, + "vlan_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "If this is set, then the Cohesity host name or the IP address associated with this VLAN is used for mounting Cohesity's view on the remote host.", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "sql_protection_source": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies an Object representing one SQL Server instance or database.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "is_available_for_vss_backup": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether the database is marked as available for backup according to the SQL Server VSS writer. This may be false if either the state of the databases is not online, or if the VSS writer is not online. This field is set only for type 'kDatabase'.", + }, + "created_timestamp": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the time when the database was created. It is displayed in the timezone of the SQL server on which this database is running.", + }, + "database_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the database name of the SQL Protection Source, if the type is database.", + }, + "db_aag_entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the AAG entity id if the database is part of an AAG. This field is set only for type 'kDatabase'.", + }, + "db_aag_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the name of the AAG if the database is part of an AAG. This field is set only for type 'kDatabase'.", + }, + "db_compatibility_level": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the versions of SQL server that the database is compatible with.", + }, + "db_file_groups": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the information about the set of file groups for this db on the host. This is only set if the type is kDatabase.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "db_files": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the last known information about the set of database files on the host. This field is set only for type 'kDatabase'.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "file_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the format type of the file that SQL database stores the data. Specifies the format type of the file that SQL database stores the data. 'kRows' refers to a data file 'kLog' refers to a log file 'kFileStream' refers to a directory containing FILESTREAM data 'kNotSupportedType' is for information purposes only. Not supported. 'kFullText' refers to a full-text catalog.", + }, + "full_path": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the full path of the database file on the SQL host machine.", + }, + "size_bytes": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the last known size of the database file.", + }, + }, + }, + }, + "db_owner_username": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the name of the database owner.", + }, + "default_database_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the default path for data files for DBs in an instance.", + }, + "default_log_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the default path for log files for DBs in an instance.", + }, + "id": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies a unique id for a SQL Protection Source.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "created_date_msecs": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies a unique identifier generated from the date the database is created or renamed. Cohesity uses this identifier in combination with the databaseId to uniquely identify a database.", + }, + "database_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies a unique id of the database but only for the life of the database. SQL Server may reuse database ids. Cohesity uses the createDateMsecs in combination with this databaseId to uniquely identify a database.", + }, + "instance_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies unique id for the SQL Server instance. This id does not change during the life of the instance.", }, }, }, @@ -7619,41 +8141,302 @@ func DataSourceIbmBackupRecoveryProtectionSources() *schema.Resource { }, }, }, - "sql_protection_source": &schema.Schema{ + "kubernetes_protection_source": &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: "Specifies an Object representing one SQL Server instance or database.", + Description: "Specifies a Protection Source in Kubernetes environment.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "is_available_for_vss_backup": &schema.Schema{ - Type: schema.TypeBool, - Computed: true, - Description: "Specifies whether the database is marked as available for backup according to the SQL Server VSS writer. This may be false if either the state of the databases is not online, or if the VSS writer is not online. This field is set only for type 'kDatabase'.", - }, - "created_timestamp": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "Specifies the time when the database was created. It is displayed in the timezone of the SQL server on which this database is running.", - }, - "database_name": &schema.Schema{ + "datamover_image_location": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the database name of the SQL Protection Source, if the type is database.", + Description: "Specifies the location of Datamover image in private registry.", }, - "db_aag_entity_id": &schema.Schema{ + "datamover_service_type": &schema.Schema{ Type: schema.TypeInt, Computed: true, - Description: "Specifies the AAG entity id if the database is part of an AAG. This field is set only for type 'kDatabase'.", + Description: "Specifies Type of service to be deployed for communication with DataMover pods. Currently, LoadBalancer and NodePort are supported. [default = kNodePort].", }, - "db_aag_name": &schema.Schema{ + "datamover_upgradability": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the name of the AAG if the database is part of an AAG. This field is set only for type 'kDatabase'.", + Description: "Specifies if the deployed Datamover image needs to be upgraded for this kubernetes entity.", }, - "db_compatibility_level": &schema.Schema{ - Type: schema.TypeInt, + "default_vlan_params": &schema.Schema{ + Type: schema.TypeList, Computed: true, - Description: "Specifies the versions of SQL server that the database is compatible with.", + Description: "Specifies VLAN parameters for the restore operation.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "disable_vlan": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether to use the VIPs even when VLANs are configured on the Cluster. If configured, VLAN IP addresses are used by default. If VLANs are not configured, this flag is ignored. Set this flag to true to force using the partition VIPs when VLANs are configured on the Cluster.", + }, + "interface_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the physical interface group name to use for mounting Cohesity's view on the remote host. If specified, Cohesity hostname or the IP address on this VLAN is used.", + }, + "vlan": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the VLAN to use for mounting Cohesity's view on the remote host. If specified, Cohesity hostname or the IP address on this VLAN is used.", + }, + }, + }, + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies an optional description of the object.", + }, + "distribution": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the type of the entity in a Kubernetes environment. Determines the K8s distribution. kIKS, kROKS.", + }, + "init_container_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of the image for init containers.", + }, + "label_attributes": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the list of label attributes of this source.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the Cohesity id of the K8s label.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the appended key and value of the K8s label.", + }, + "uuid": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies Kubernetes Unique Identifier (UUID) of the K8s label.", + }, + }, + }, + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies a unique name of the Protection Source.", + }, + "priority_class_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the pritority class name during registration.", + }, + "resource_annotation_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies resource Annotations information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Key for label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Value for label.", + }, + }, + }, + }, + "resource_label_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies resource labels information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Key for label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Value for label.", + }, + }, + }, + }, + "san_field": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the SAN field for agent certificate.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "service_annotations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies annotations to be put on services for IP allocation. Applicable only when service is of type LoadBalancer.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "storage_class": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies storage class information of source.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies name of storage class.", + }, + "provisioner": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "specifies provisioner of storage class.", + }, + }, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the type of the entity in a Kubernetes environment. Specifies the type of a Kubernetes Protection Source. 'kCluster' indicates a Kubernetes Cluster. 'kNamespace' indicates a namespace in a Kubernetes Cluster. 'kService' indicates a service running on a Kubernetes Cluster.", + }, + "uuid": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the UUID of the object.", + }, + "velero_aws_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of Velero AWS plugin image in private registry.", + }, + "velero_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of Velero image in private registry.", + }, + "velero_openshift_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of the image for openshift plugin container.", + }, + "velero_upgradability": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies if the deployed Velero image needs to be upgraded for this kubernetes entity.", + }, + "vlan_info_vec": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "service_annotations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies annotations to be put on services for IP allocation. Applicable only when service is of type LoadBalancer.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the service annotation key value.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the service annotation value.", + }, + }, + }, + }, + "vlan_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN params associated with the backup/restore operation.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "disable_vlan": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "If this is set to true, then even if VLANs are configured on the system, the partition VIPs will be used for the restore.", + }, + "interface_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Interface group to use for backup/restore. If this is not specified, primary interface group for the cluster will be used.", + }, + "vlan_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "If this is set, then the Cohesity host name or the IP address associated with this VLAN is used for mounting Cohesity's view on the remote host.", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "sql_protection_source": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies an Object representing one SQL Server instance or database.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "is_available_for_vss_backup": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether the database is marked as available for backup according to the SQL Server VSS writer. This may be false if either the state of the databases is not online, or if the VSS writer is not online. This field is set only for type 'kDatabase'.", + }, + "created_timestamp": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the time when the database was created. It is displayed in the timezone of the SQL server on which this database is running.", + }, + "database_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the database name of the SQL Protection Source, if the type is database.", + }, + "db_aag_entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the AAG entity id if the database is part of an AAG. This field is set only for type 'kDatabase'.", + }, + "db_aag_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the name of the AAG if the database is part of an AAG. This field is set only for type 'kDatabase'.", + }, + "db_compatibility_level": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the versions of SQL server that the database is compatible with.", }, "db_file_groups": &schema.Schema{ Type: schema.TypeList, @@ -10516,70 +11299,331 @@ func DataSourceIbmBackupRecoveryProtectionSources() *schema.Resource { }, }, }, - "sql_protection_source": &schema.Schema{ + "kubernetes_protection_source": &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: "Specifies an Object representing one SQL Server instance or database.", + Description: "Specifies a Protection Source in Kubernetes environment.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "is_available_for_vss_backup": &schema.Schema{ - Type: schema.TypeBool, - Computed: true, - Description: "Specifies whether the database is marked as available for backup according to the SQL Server VSS writer. This may be false if either the state of the databases is not online, or if the VSS writer is not online. This field is set only for type 'kDatabase'.", - }, - "created_timestamp": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "Specifies the time when the database was created. It is displayed in the timezone of the SQL server on which this database is running.", - }, - "database_name": &schema.Schema{ + "datamover_image_location": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the database name of the SQL Protection Source, if the type is database.", + Description: "Specifies the location of Datamover image in private registry.", }, - "db_aag_entity_id": &schema.Schema{ + "datamover_service_type": &schema.Schema{ Type: schema.TypeInt, Computed: true, - Description: "Specifies the AAG entity id if the database is part of an AAG. This field is set only for type 'kDatabase'.", + Description: "Specifies Type of service to be deployed for communication with DataMover pods. Currently, LoadBalancer and NodePort are supported. [default = kNodePort].", }, - "db_aag_name": &schema.Schema{ + "datamover_upgradability": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the name of the AAG if the database is part of an AAG. This field is set only for type 'kDatabase'.", - }, - "db_compatibility_level": &schema.Schema{ - Type: schema.TypeInt, - Computed: true, - Description: "Specifies the versions of SQL server that the database is compatible with.", - }, - "db_file_groups": &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: "Specifies the information about the set of file groups for this db on the host. This is only set if the type is kDatabase.", - Elem: &schema.Schema{ - Type: schema.TypeString, - }, + Description: "Specifies if the deployed Datamover image needs to be upgraded for this kubernetes entity.", }, - "db_files": &schema.Schema{ + "default_vlan_params": &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: "Specifies the last known information about the set of database files on the host. This field is set only for type 'kDatabase'.", + Description: "Specifies VLAN parameters for the restore operation.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "file_type": &schema.Schema{ - Type: schema.TypeString, + "disable_vlan": &schema.Schema{ + Type: schema.TypeBool, Computed: true, - Description: "Specifies the format type of the file that SQL database stores the data. Specifies the format type of the file that SQL database stores the data. 'kRows' refers to a data file 'kLog' refers to a log file 'kFileStream' refers to a directory containing FILESTREAM data 'kNotSupportedType' is for information purposes only. Not supported. 'kFullText' refers to a full-text catalog.", + Description: "Specifies whether to use the VIPs even when VLANs are configured on the Cluster. If configured, VLAN IP addresses are used by default. If VLANs are not configured, this flag is ignored. Set this flag to true to force using the partition VIPs when VLANs are configured on the Cluster.", }, - "full_path": &schema.Schema{ + "interface_name": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the full path of the database file on the SQL host machine.", + Description: "Specifies the physical interface group name to use for mounting Cohesity's view on the remote host. If specified, Cohesity hostname or the IP address on this VLAN is used.", }, - "size_bytes": &schema.Schema{ + "vlan": &schema.Schema{ Type: schema.TypeInt, Computed: true, - Description: "Specifies the last known size of the database file.", + Description: "Specifies the VLAN to use for mounting Cohesity's view on the remote host. If specified, Cohesity hostname or the IP address on this VLAN is used.", + }, + }, + }, + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies an optional description of the object.", + }, + "distribution": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the type of the entity in a Kubernetes environment. Determines the K8s distribution. kIKS, kROKS.", + }, + "init_container_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of the image for init containers.", + }, + "label_attributes": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the list of label attributes of this source.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the Cohesity id of the K8s label.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the appended key and value of the K8s label.", + }, + "uuid": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies Kubernetes Unique Identifier (UUID) of the K8s label.", + }, + }, + }, + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies a unique name of the Protection Source.", + }, + "priority_class_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the pritority class name during registration.", + }, + "resource_annotation_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies resource Annotations information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Key for label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Value for label.", + }, + }, + }, + }, + "resource_label_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies resource labels information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Key for label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Value for label.", + }, + }, + }, + }, + "san_field": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the SAN field for agent certificate.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "service_annotations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies annotations to be put on services for IP allocation. Applicable only when service is of type LoadBalancer.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "storage_class": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies storage class information of source.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies name of storage class.", + }, + "provisioner": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "specifies provisioner of storage class.", + }, + }, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the type of the entity in a Kubernetes environment. Specifies the type of a Kubernetes Protection Source. 'kCluster' indicates a Kubernetes Cluster. 'kNamespace' indicates a namespace in a Kubernetes Cluster. 'kService' indicates a service running on a Kubernetes Cluster.", + }, + "uuid": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the UUID of the object.", + }, + "velero_aws_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of Velero AWS plugin image in private registry.", + }, + "velero_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of Velero image in private registry.", + }, + "velero_openshift_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of the image for openshift plugin container.", + }, + "velero_upgradability": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies if the deployed Velero image needs to be upgraded for this kubernetes entity.", + }, + "vlan_info_vec": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "service_annotations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies annotations to be put on services for IP allocation. Applicable only when service is of type LoadBalancer.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the service annotation key value.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the service annotation value.", + }, + }, + }, + }, + "vlan_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN params associated with the backup/restore operation.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "disable_vlan": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "If this is set to true, then even if VLANs are configured on the system, the partition VIPs will be used for the restore.", + }, + "interface_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Interface group to use for backup/restore. If this is not specified, primary interface group for the cluster will be used.", + }, + "vlan_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "If this is set, then the Cohesity host name or the IP address associated with this VLAN is used for mounting Cohesity's view on the remote host.", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "sql_protection_source": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies an Object representing one SQL Server instance or database.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "is_available_for_vss_backup": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether the database is marked as available for backup according to the SQL Server VSS writer. This may be false if either the state of the databases is not online, or if the VSS writer is not online. This field is set only for type 'kDatabase'.", + }, + "created_timestamp": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the time when the database was created. It is displayed in the timezone of the SQL server on which this database is running.", + }, + "database_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the database name of the SQL Protection Source, if the type is database.", + }, + "db_aag_entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the AAG entity id if the database is part of an AAG. This field is set only for type 'kDatabase'.", + }, + "db_aag_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the name of the AAG if the database is part of an AAG. This field is set only for type 'kDatabase'.", + }, + "db_compatibility_level": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the versions of SQL server that the database is compatible with.", + }, + "db_file_groups": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the information about the set of file groups for this db on the host. This is only set if the type is kDatabase.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "db_files": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the last known information about the set of database files on the host. This field is set only for type 'kDatabase'.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "file_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the format type of the file that SQL database stores the data. Specifies the format type of the file that SQL database stores the data. 'kRows' refers to a data file 'kLog' refers to a log file 'kFileStream' refers to a directory containing FILESTREAM data 'kNotSupportedType' is for information purposes only. Not supported. 'kFullText' refers to a full-text catalog.", + }, + "full_path": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the full path of the database file on the SQL host machine.", + }, + "size_bytes": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the last known size of the database file.", }, }, }, @@ -13231,51 +14275,312 @@ func DataSourceIbmBackupRecoveryProtectionSources() *schema.Resource { }, }, }, - "sql_protection_source": &schema.Schema{ + "kubernetes_protection_source": &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: "Specifies an Object representing one SQL Server instance or database.", + Description: "Specifies a Protection Source in Kubernetes environment.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "is_available_for_vss_backup": &schema.Schema{ - Type: schema.TypeBool, - Computed: true, - Description: "Specifies whether the database is marked as available for backup according to the SQL Server VSS writer. This may be false if either the state of the databases is not online, or if the VSS writer is not online. This field is set only for type 'kDatabase'.", - }, - "created_timestamp": &schema.Schema{ + "datamover_image_location": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the time when the database was created. It is displayed in the timezone of the SQL server on which this database is running.", - }, - "database_name": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "Specifies the database name of the SQL Protection Source, if the type is database.", + Description: "Specifies the location of Datamover image in private registry.", }, - "db_aag_entity_id": &schema.Schema{ + "datamover_service_type": &schema.Schema{ Type: schema.TypeInt, Computed: true, - Description: "Specifies the AAG entity id if the database is part of an AAG. This field is set only for type 'kDatabase'.", + Description: "Specifies Type of service to be deployed for communication with DataMover pods. Currently, LoadBalancer and NodePort are supported. [default = kNodePort].", }, - "db_aag_name": &schema.Schema{ + "datamover_upgradability": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the name of the AAG if the database is part of an AAG. This field is set only for type 'kDatabase'.", - }, - "db_compatibility_level": &schema.Schema{ - Type: schema.TypeInt, - Computed: true, - Description: "Specifies the versions of SQL server that the database is compatible with.", - }, - "db_file_groups": &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: "Specifies the information about the set of file groups for this db on the host. This is only set if the type is kDatabase.", - Elem: &schema.Schema{ - Type: schema.TypeString, - }, + Description: "Specifies if the deployed Datamover image needs to be upgraded for this kubernetes entity.", }, - "db_files": &schema.Schema{ + "default_vlan_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN parameters for the restore operation.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "disable_vlan": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether to use the VIPs even when VLANs are configured on the Cluster. If configured, VLAN IP addresses are used by default. If VLANs are not configured, this flag is ignored. Set this flag to true to force using the partition VIPs when VLANs are configured on the Cluster.", + }, + "interface_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the physical interface group name to use for mounting Cohesity's view on the remote host. If specified, Cohesity hostname or the IP address on this VLAN is used.", + }, + "vlan": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the VLAN to use for mounting Cohesity's view on the remote host. If specified, Cohesity hostname or the IP address on this VLAN is used.", + }, + }, + }, + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies an optional description of the object.", + }, + "distribution": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the type of the entity in a Kubernetes environment. Determines the K8s distribution. kIKS, kROKS.", + }, + "init_container_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of the image for init containers.", + }, + "label_attributes": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the list of label attributes of this source.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the Cohesity id of the K8s label.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the appended key and value of the K8s label.", + }, + "uuid": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies Kubernetes Unique Identifier (UUID) of the K8s label.", + }, + }, + }, + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies a unique name of the Protection Source.", + }, + "priority_class_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the pritority class name during registration.", + }, + "resource_annotation_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies resource Annotations information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Key for label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Value for label.", + }, + }, + }, + }, + "resource_label_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies resource labels information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Key for label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Value for label.", + }, + }, + }, + }, + "san_field": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the SAN field for agent certificate.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "service_annotations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies annotations to be put on services for IP allocation. Applicable only when service is of type LoadBalancer.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "storage_class": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies storage class information of source.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies name of storage class.", + }, + "provisioner": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "specifies provisioner of storage class.", + }, + }, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the type of the entity in a Kubernetes environment. Specifies the type of a Kubernetes Protection Source. 'kCluster' indicates a Kubernetes Cluster. 'kNamespace' indicates a namespace in a Kubernetes Cluster. 'kService' indicates a service running on a Kubernetes Cluster.", + }, + "uuid": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the UUID of the object.", + }, + "velero_aws_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of Velero AWS plugin image in private registry.", + }, + "velero_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of Velero image in private registry.", + }, + "velero_openshift_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of the image for openshift plugin container.", + }, + "velero_upgradability": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies if the deployed Velero image needs to be upgraded for this kubernetes entity.", + }, + "vlan_info_vec": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "service_annotations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies annotations to be put on services for IP allocation. Applicable only when service is of type LoadBalancer.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the service annotation key value.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the service annotation value.", + }, + }, + }, + }, + "vlan_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN params associated with the backup/restore operation.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "disable_vlan": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "If this is set to true, then even if VLANs are configured on the system, the partition VIPs will be used for the restore.", + }, + "interface_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Interface group to use for backup/restore. If this is not specified, primary interface group for the cluster will be used.", + }, + "vlan_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "If this is set, then the Cohesity host name or the IP address associated with this VLAN is used for mounting Cohesity's view on the remote host.", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "sql_protection_source": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies an Object representing one SQL Server instance or database.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "is_available_for_vss_backup": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether the database is marked as available for backup according to the SQL Server VSS writer. This may be false if either the state of the databases is not online, or if the VSS writer is not online. This field is set only for type 'kDatabase'.", + }, + "created_timestamp": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the time when the database was created. It is displayed in the timezone of the SQL server on which this database is running.", + }, + "database_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the database name of the SQL Protection Source, if the type is database.", + }, + "db_aag_entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the AAG entity id if the database is part of an AAG. This field is set only for type 'kDatabase'.", + }, + "db_aag_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the name of the AAG if the database is part of an AAG. This field is set only for type 'kDatabase'.", + }, + "db_compatibility_level": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the versions of SQL server that the database is compatible with.", + }, + "db_file_groups": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the information about the set of file groups for this db on the host. This is only set if the type is kDatabase.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "db_files": &schema.Schema{ Type: schema.TypeList, Computed: true, Description: "Specifies the last known information about the set of database files on the host. This field is set only for type 'kDatabase'.", @@ -15795,57 +17100,318 @@ func DataSourceIbmBackupRecoveryProtectionSources() *schema.Resource { }, }, }, - "sql_protection_source": &schema.Schema{ + "kubernetes_protection_source": &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: "Specifies an Object representing one SQL Server instance or database.", + Description: "Specifies a Protection Source in Kubernetes environment.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "is_available_for_vss_backup": &schema.Schema{ - Type: schema.TypeBool, - Computed: true, - Description: "Specifies whether the database is marked as available for backup according to the SQL Server VSS writer. This may be false if either the state of the databases is not online, or if the VSS writer is not online. This field is set only for type 'kDatabase'.", - }, - "created_timestamp": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "Specifies the time when the database was created. It is displayed in the timezone of the SQL server on which this database is running.", - }, - "database_name": &schema.Schema{ + "datamover_image_location": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the database name of the SQL Protection Source, if the type is database.", + Description: "Specifies the location of Datamover image in private registry.", }, - "db_aag_entity_id": &schema.Schema{ + "datamover_service_type": &schema.Schema{ Type: schema.TypeInt, Computed: true, - Description: "Specifies the AAG entity id if the database is part of an AAG. This field is set only for type 'kDatabase'.", + Description: "Specifies Type of service to be deployed for communication with DataMover pods. Currently, LoadBalancer and NodePort are supported. [default = kNodePort].", }, - "db_aag_name": &schema.Schema{ + "datamover_upgradability": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the name of the AAG if the database is part of an AAG. This field is set only for type 'kDatabase'.", - }, - "db_compatibility_level": &schema.Schema{ - Type: schema.TypeInt, - Computed: true, - Description: "Specifies the versions of SQL server that the database is compatible with.", - }, - "db_file_groups": &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: "Specifies the information about the set of file groups for this db on the host. This is only set if the type is kDatabase.", - Elem: &schema.Schema{ - Type: schema.TypeString, - }, + Description: "Specifies if the deployed Datamover image needs to be upgraded for this kubernetes entity.", }, - "db_files": &schema.Schema{ + "default_vlan_params": &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: "Specifies the last known information about the set of database files on the host. This field is set only for type 'kDatabase'.", + Description: "Specifies VLAN parameters for the restore operation.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "file_type": &schema.Schema{ + "disable_vlan": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether to use the VIPs even when VLANs are configured on the Cluster. If configured, VLAN IP addresses are used by default. If VLANs are not configured, this flag is ignored. Set this flag to true to force using the partition VIPs when VLANs are configured on the Cluster.", + }, + "interface_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the physical interface group name to use for mounting Cohesity's view on the remote host. If specified, Cohesity hostname or the IP address on this VLAN is used.", + }, + "vlan": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the VLAN to use for mounting Cohesity's view on the remote host. If specified, Cohesity hostname or the IP address on this VLAN is used.", + }, + }, + }, + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies an optional description of the object.", + }, + "distribution": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the type of the entity in a Kubernetes environment. Determines the K8s distribution. kIKS, kROKS.", + }, + "init_container_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of the image for init containers.", + }, + "label_attributes": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the list of label attributes of this source.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the Cohesity id of the K8s label.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the appended key and value of the K8s label.", + }, + "uuid": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies Kubernetes Unique Identifier (UUID) of the K8s label.", + }, + }, + }, + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies a unique name of the Protection Source.", + }, + "priority_class_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the pritority class name during registration.", + }, + "resource_annotation_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies resource Annotations information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Key for label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Value for label.", + }, + }, + }, + }, + "resource_label_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies resource labels information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Key for label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Value for label.", + }, + }, + }, + }, + "san_field": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the SAN field for agent certificate.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "service_annotations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies annotations to be put on services for IP allocation. Applicable only when service is of type LoadBalancer.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "storage_class": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies storage class information of source.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies name of storage class.", + }, + "provisioner": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "specifies provisioner of storage class.", + }, + }, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the type of the entity in a Kubernetes environment. Specifies the type of a Kubernetes Protection Source. 'kCluster' indicates a Kubernetes Cluster. 'kNamespace' indicates a namespace in a Kubernetes Cluster. 'kService' indicates a service running on a Kubernetes Cluster.", + }, + "uuid": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the UUID of the object.", + }, + "velero_aws_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of Velero AWS plugin image in private registry.", + }, + "velero_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of Velero image in private registry.", + }, + "velero_openshift_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of the image for openshift plugin container.", + }, + "velero_upgradability": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies if the deployed Velero image needs to be upgraded for this kubernetes entity.", + }, + "vlan_info_vec": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "service_annotations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies annotations to be put on services for IP allocation. Applicable only when service is of type LoadBalancer.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the service annotation key value.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the service annotation value.", + }, + }, + }, + }, + "vlan_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN params associated with the backup/restore operation.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "disable_vlan": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "If this is set to true, then even if VLANs are configured on the system, the partition VIPs will be used for the restore.", + }, + "interface_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Interface group to use for backup/restore. If this is not specified, primary interface group for the cluster will be used.", + }, + "vlan_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "If this is set, then the Cohesity host name or the IP address associated with this VLAN is used for mounting Cohesity's view on the remote host.", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "sql_protection_source": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies an Object representing one SQL Server instance or database.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "is_available_for_vss_backup": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether the database is marked as available for backup according to the SQL Server VSS writer. This may be false if either the state of the databases is not online, or if the VSS writer is not online. This field is set only for type 'kDatabase'.", + }, + "created_timestamp": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the time when the database was created. It is displayed in the timezone of the SQL server on which this database is running.", + }, + "database_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the database name of the SQL Protection Source, if the type is database.", + }, + "db_aag_entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the AAG entity id if the database is part of an AAG. This field is set only for type 'kDatabase'.", + }, + "db_aag_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the name of the AAG if the database is part of an AAG. This field is set only for type 'kDatabase'.", + }, + "db_compatibility_level": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the versions of SQL server that the database is compatible with.", + }, + "db_file_groups": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the information about the set of file groups for this db on the host. This is only set if the type is kDatabase.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "db_files": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the last known information about the set of database files on the host. This field is set only for type 'kDatabase'.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "file_type": &schema.Schema{ Type: schema.TypeString, Computed: true, Description: "Specifies the format type of the file that SQL database stores the data. Specifies the format type of the file that SQL database stores the data. 'kRows' refers to a data file 'kLog' refers to a log file 'kFileStream' refers to a directory containing FILESTREAM data 'kNotSupportedType' is for information purposes only. Not supported. 'kFullText' refers to a full-text catalog.", @@ -18354,51 +19920,312 @@ func DataSourceIbmBackupRecoveryProtectionSources() *schema.Resource { }, }, }, - "sql_protection_source": &schema.Schema{ + "kubernetes_protection_source": &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: "Specifies an Object representing one SQL Server instance or database.", + Description: "Specifies a Protection Source in Kubernetes environment.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "is_available_for_vss_backup": &schema.Schema{ - Type: schema.TypeBool, - Computed: true, - Description: "Specifies whether the database is marked as available for backup according to the SQL Server VSS writer. This may be false if either the state of the databases is not online, or if the VSS writer is not online. This field is set only for type 'kDatabase'.", - }, - "created_timestamp": &schema.Schema{ + "datamover_image_location": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the time when the database was created. It is displayed in the timezone of the SQL server on which this database is running.", - }, - "database_name": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "Specifies the database name of the SQL Protection Source, if the type is database.", + Description: "Specifies the location of Datamover image in private registry.", }, - "db_aag_entity_id": &schema.Schema{ + "datamover_service_type": &schema.Schema{ Type: schema.TypeInt, Computed: true, - Description: "Specifies the AAG entity id if the database is part of an AAG. This field is set only for type 'kDatabase'.", + Description: "Specifies Type of service to be deployed for communication with DataMover pods. Currently, LoadBalancer and NodePort are supported. [default = kNodePort].", }, - "db_aag_name": &schema.Schema{ + "datamover_upgradability": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the name of the AAG if the database is part of an AAG. This field is set only for type 'kDatabase'.", - }, - "db_compatibility_level": &schema.Schema{ - Type: schema.TypeInt, - Computed: true, - Description: "Specifies the versions of SQL server that the database is compatible with.", - }, - "db_file_groups": &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: "Specifies the information about the set of file groups for this db on the host. This is only set if the type is kDatabase.", - Elem: &schema.Schema{ - Type: schema.TypeString, - }, + Description: "Specifies if the deployed Datamover image needs to be upgraded for this kubernetes entity.", }, - "db_files": &schema.Schema{ + "default_vlan_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN parameters for the restore operation.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "disable_vlan": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether to use the VIPs even when VLANs are configured on the Cluster. If configured, VLAN IP addresses are used by default. If VLANs are not configured, this flag is ignored. Set this flag to true to force using the partition VIPs when VLANs are configured on the Cluster.", + }, + "interface_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the physical interface group name to use for mounting Cohesity's view on the remote host. If specified, Cohesity hostname or the IP address on this VLAN is used.", + }, + "vlan": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the VLAN to use for mounting Cohesity's view on the remote host. If specified, Cohesity hostname or the IP address on this VLAN is used.", + }, + }, + }, + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies an optional description of the object.", + }, + "distribution": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the type of the entity in a Kubernetes environment. Determines the K8s distribution. kIKS, kROKS.", + }, + "init_container_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of the image for init containers.", + }, + "label_attributes": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the list of label attributes of this source.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the Cohesity id of the K8s label.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the appended key and value of the K8s label.", + }, + "uuid": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies Kubernetes Unique Identifier (UUID) of the K8s label.", + }, + }, + }, + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies a unique name of the Protection Source.", + }, + "priority_class_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the pritority class name during registration.", + }, + "resource_annotation_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies resource Annotations information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Key for label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Value for label.", + }, + }, + }, + }, + "resource_label_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies resource labels information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Key for label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Value for label.", + }, + }, + }, + }, + "san_field": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the SAN field for agent certificate.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "service_annotations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies annotations to be put on services for IP allocation. Applicable only when service is of type LoadBalancer.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "storage_class": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies storage class information of source.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies name of storage class.", + }, + "provisioner": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "specifies provisioner of storage class.", + }, + }, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the type of the entity in a Kubernetes environment. Specifies the type of a Kubernetes Protection Source. 'kCluster' indicates a Kubernetes Cluster. 'kNamespace' indicates a namespace in a Kubernetes Cluster. 'kService' indicates a service running on a Kubernetes Cluster.", + }, + "uuid": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the UUID of the object.", + }, + "velero_aws_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of Velero AWS plugin image in private registry.", + }, + "velero_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of Velero image in private registry.", + }, + "velero_openshift_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of the image for openshift plugin container.", + }, + "velero_upgradability": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies if the deployed Velero image needs to be upgraded for this kubernetes entity.", + }, + "vlan_info_vec": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "service_annotations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies annotations to be put on services for IP allocation. Applicable only when service is of type LoadBalancer.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the service annotation key value.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the service annotation value.", + }, + }, + }, + }, + "vlan_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN params associated with the backup/restore operation.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "disable_vlan": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "If this is set to true, then even if VLANs are configured on the system, the partition VIPs will be used for the restore.", + }, + "interface_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Interface group to use for backup/restore. If this is not specified, primary interface group for the cluster will be used.", + }, + "vlan_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "If this is set, then the Cohesity host name or the IP address associated with this VLAN is used for mounting Cohesity's view on the remote host.", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "sql_protection_source": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies an Object representing one SQL Server instance or database.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "is_available_for_vss_backup": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether the database is marked as available for backup according to the SQL Server VSS writer. This may be false if either the state of the databases is not online, or if the VSS writer is not online. This field is set only for type 'kDatabase'.", + }, + "created_timestamp": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the time when the database was created. It is displayed in the timezone of the SQL server on which this database is running.", + }, + "database_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the database name of the SQL Protection Source, if the type is database.", + }, + "db_aag_entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the AAG entity id if the database is part of an AAG. This field is set only for type 'kDatabase'.", + }, + "db_aag_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the name of the AAG if the database is part of an AAG. This field is set only for type 'kDatabase'.", + }, + "db_compatibility_level": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the versions of SQL server that the database is compatible with.", + }, + "db_file_groups": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the information about the set of file groups for this db on the host. This is only set if the type is kDatabase.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "db_files": &schema.Schema{ Type: schema.TypeList, Computed: true, Description: "Specifies the last known information about the set of database files on the host. This field is set only for type 'kDatabase'.", @@ -20913,60 +22740,321 @@ func DataSourceIbmBackupRecoveryProtectionSources() *schema.Resource { }, }, }, - "sql_protection_source": &schema.Schema{ + "kubernetes_protection_source": &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: "Specifies an Object representing one SQL Server instance or database.", + Description: "Specifies a Protection Source in Kubernetes environment.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "is_available_for_vss_backup": &schema.Schema{ - Type: schema.TypeBool, - Computed: true, - Description: "Specifies whether the database is marked as available for backup according to the SQL Server VSS writer. This may be false if either the state of the databases is not online, or if the VSS writer is not online. This field is set only for type 'kDatabase'.", - }, - "created_timestamp": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "Specifies the time when the database was created. It is displayed in the timezone of the SQL server on which this database is running.", - }, - "database_name": &schema.Schema{ + "datamover_image_location": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the database name of the SQL Protection Source, if the type is database.", + Description: "Specifies the location of Datamover image in private registry.", }, - "db_aag_entity_id": &schema.Schema{ + "datamover_service_type": &schema.Schema{ Type: schema.TypeInt, Computed: true, - Description: "Specifies the AAG entity id if the database is part of an AAG. This field is set only for type 'kDatabase'.", + Description: "Specifies Type of service to be deployed for communication with DataMover pods. Currently, LoadBalancer and NodePort are supported. [default = kNodePort].", }, - "db_aag_name": &schema.Schema{ + "datamover_upgradability": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "Specifies the name of the AAG if the database is part of an AAG. This field is set only for type 'kDatabase'.", - }, - "db_compatibility_level": &schema.Schema{ - Type: schema.TypeInt, - Computed: true, - Description: "Specifies the versions of SQL server that the database is compatible with.", - }, - "db_file_groups": &schema.Schema{ - Type: schema.TypeList, - Computed: true, - Description: "Specifies the information about the set of file groups for this db on the host. This is only set if the type is kDatabase.", - Elem: &schema.Schema{ - Type: schema.TypeString, - }, + Description: "Specifies if the deployed Datamover image needs to be upgraded for this kubernetes entity.", }, - "db_files": &schema.Schema{ + "default_vlan_params": &schema.Schema{ Type: schema.TypeList, Computed: true, - Description: "Specifies the last known information about the set of database files on the host. This field is set only for type 'kDatabase'.", + Description: "Specifies VLAN parameters for the restore operation.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "file_type": &schema.Schema{ - Type: schema.TypeString, + "disable_vlan": &schema.Schema{ + Type: schema.TypeBool, Computed: true, - Description: "Specifies the format type of the file that SQL database stores the data. Specifies the format type of the file that SQL database stores the data. 'kRows' refers to a data file 'kLog' refers to a log file 'kFileStream' refers to a directory containing FILESTREAM data 'kNotSupportedType' is for information purposes only. Not supported. 'kFullText' refers to a full-text catalog.", + Description: "Specifies whether to use the VIPs even when VLANs are configured on the Cluster. If configured, VLAN IP addresses are used by default. If VLANs are not configured, this flag is ignored. Set this flag to true to force using the partition VIPs when VLANs are configured on the Cluster.", + }, + "interface_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the physical interface group name to use for mounting Cohesity's view on the remote host. If specified, Cohesity hostname or the IP address on this VLAN is used.", + }, + "vlan": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the VLAN to use for mounting Cohesity's view on the remote host. If specified, Cohesity hostname or the IP address on this VLAN is used.", + }, + }, + }, + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies an optional description of the object.", + }, + "distribution": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the type of the entity in a Kubernetes environment. Determines the K8s distribution. kIKS, kROKS.", + }, + "init_container_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of the image for init containers.", + }, + "label_attributes": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the list of label attributes of this source.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the Cohesity id of the K8s label.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the appended key and value of the K8s label.", + }, + "uuid": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies Kubernetes Unique Identifier (UUID) of the K8s label.", + }, + }, + }, + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies a unique name of the Protection Source.", + }, + "priority_class_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the pritority class name during registration.", + }, + "resource_annotation_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies resource Annotations information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Key for label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Value for label.", + }, + }, + }, + }, + "resource_label_list": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies resource labels information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Key for label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Value for label.", + }, + }, + }, + }, + "san_field": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the SAN field for agent certificate.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "service_annotations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies annotations to be put on services for IP allocation. Applicable only when service is of type LoadBalancer.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "storage_class": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies storage class information of source.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies name of storage class.", + }, + "provisioner": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "specifies provisioner of storage class.", + }, + }, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the type of the entity in a Kubernetes environment. Specifies the type of a Kubernetes Protection Source. 'kCluster' indicates a Kubernetes Cluster. 'kNamespace' indicates a namespace in a Kubernetes Cluster. 'kService' indicates a service running on a Kubernetes Cluster.", + }, + "uuid": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the UUID of the object.", + }, + "velero_aws_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of Velero AWS plugin image in private registry.", + }, + "velero_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of Velero image in private registry.", + }, + "velero_openshift_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the location of the image for openshift plugin container.", + }, + "velero_upgradability": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies if the deployed Velero image needs to be upgraded for this kubernetes entity.", + }, + "vlan_info_vec": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN information provided during registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "service_annotations": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies annotations to be put on services for IP allocation. Applicable only when service is of type LoadBalancer.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the service annotation key value.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the service annotation value.", + }, + }, + }, + }, + "vlan_params": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies VLAN params associated with the backup/restore operation.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "disable_vlan": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "If this is set to true, then even if VLANs are configured on the system, the partition VIPs will be used for the restore.", + }, + "interface_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Interface group to use for backup/restore. If this is not specified, primary interface group for the cluster will be used.", + }, + "vlan_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "If this is set, then the Cohesity host name or the IP address associated with this VLAN is used for mounting Cohesity's view on the remote host.", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "sql_protection_source": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies an Object representing one SQL Server instance or database.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "is_available_for_vss_backup": &schema.Schema{ + Type: schema.TypeBool, + Computed: true, + Description: "Specifies whether the database is marked as available for backup according to the SQL Server VSS writer. This may be false if either the state of the databases is not online, or if the VSS writer is not online. This field is set only for type 'kDatabase'.", + }, + "created_timestamp": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the time when the database was created. It is displayed in the timezone of the SQL server on which this database is running.", + }, + "database_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the database name of the SQL Protection Source, if the type is database.", + }, + "db_aag_entity_id": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the AAG entity id if the database is part of an AAG. This field is set only for type 'kDatabase'.", + }, + "db_aag_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the name of the AAG if the database is part of an AAG. This field is set only for type 'kDatabase'.", + }, + "db_compatibility_level": &schema.Schema{ + Type: schema.TypeInt, + Computed: true, + Description: "Specifies the versions of SQL server that the database is compatible with.", + }, + "db_file_groups": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the information about the set of file groups for this db on the host. This is only set if the type is kDatabase.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "db_files": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "Specifies the last known information about the set of database files on the host. This field is set only for type 'kDatabase'.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "file_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the format type of the file that SQL database stores the data. Specifies the format type of the file that SQL database stores the data. 'kRows' refers to a data file 'kLog' refers to a log file 'kFileStream' refers to a directory containing FILESTREAM data 'kNotSupportedType' is for information purposes only. Not supported. 'kFullText' refers to a full-text catalog.", }, "full_path": &schema.Schema{ Type: schema.TypeString, @@ -22508,6 +24596,13 @@ func DataSourceIbmBackupRecoveryProtectionSourcesProtectionSourceNodeToMap(model } modelMap["physical_protection_source"] = []map[string]interface{}{physicalProtectionSourceMap} } + if model.KubernetesProtectionSource != nil { + kubernetesProtectionSourceMap, err := DataSourceIbmBackupRecoveryProtectionSourcesKubernetesProtectionSourceToMap(model.KubernetesProtectionSource) + if err != nil { + return modelMap, err + } + modelMap["kubernetes_protection_source"] = []map[string]interface{}{kubernetesProtectionSourceMap} + } if model.SqlProtectionSource != nil { sqlProtectionSourceMap, err := DataSourceIbmBackupRecoveryProtectionSourcesSqlProtectionSourceToMap(model.SqlProtectionSource) if err != nil { @@ -22518,6 +24613,238 @@ func DataSourceIbmBackupRecoveryProtectionSourcesProtectionSourceNodeToMap(model return modelMap, nil } +func DataSourceIbmBackupRecoveryProtectionSourcesKubernetesProtectionSourceToMap(model *backuprecoveryv1.KubernetesProtectionSource) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.DatamoverImageLocation != nil { + modelMap["datamover_image_location"] = *model.DatamoverImageLocation + } + if model.DatamoverServiceType != nil { + modelMap["datamover_service_type"] = flex.IntValue(model.DatamoverServiceType) + } + if model.DatamoverUpgradability != nil { + modelMap["datamover_upgradability"] = flex.StringValue(model.DatamoverUpgradability) + } + if model.DefaultVlanParams != nil { + defaultVlanParamsMap, err := DataSourceIbmBackupRecoveryProtectionSourcesVlanParametersToMap(model.DefaultVlanParams) + if err != nil { + return modelMap, err + } + modelMap["default_vlan_params"] = []map[string]interface{}{defaultVlanParamsMap} + } + if model.Description != nil { + modelMap["description"] = *model.Description + } + if model.Distribution != nil { + modelMap["distribution"] = *model.Distribution + } + if model.InitContainerImageLocation != nil { + modelMap["init_container_image_location"] = *model.InitContainerImageLocation + } + if model.LabelAttributes != nil { + labelAttributes := []map[string]interface{}{} + for _, labelAttributesItem := range model.LabelAttributes { + labelAttributesItemMap, err := DataSourceIbmBackupRecoveryProtectionSourcesKubernetesLabelAttributeToMap(&labelAttributesItem) // #nosec G601 + if err != nil { + return modelMap, err + } + labelAttributes = append(labelAttributes, labelAttributesItemMap) + } + modelMap["label_attributes"] = labelAttributes + } + if model.Name != nil { + modelMap["name"] = *model.Name + } + if model.PriorityClassName != nil { + modelMap["priority_class_name"] = *model.PriorityClassName + } + if model.ResourceAnnotationList != nil { + resourceAnnotationList := []map[string]interface{}{} + for _, resourceAnnotationListItem := range model.ResourceAnnotationList { + resourceAnnotationListItemMap, err := DataSourceIbmBackupRecoveryProtectionSourcesK8sLabelToMap(&resourceAnnotationListItem) // #nosec G601 + if err != nil { + return modelMap, err + } + resourceAnnotationList = append(resourceAnnotationList, resourceAnnotationListItemMap) + } + modelMap["resource_annotation_list"] = resourceAnnotationList + } + if model.ResourceLabelList != nil { + resourceLabelList := []map[string]interface{}{} + for _, resourceLabelListItem := range model.ResourceLabelList { + resourceLabelListItemMap, err := DataSourceIbmBackupRecoveryProtectionSourcesK8sLabelToMap(&resourceLabelListItem) // #nosec G601 + if err != nil { + return modelMap, err + } + resourceLabelList = append(resourceLabelList, resourceLabelListItemMap) + } + modelMap["resource_label_list"] = resourceLabelList + } + if model.SanField != nil { + modelMap["san_field"] = model.SanField + } + if model.ServiceAnnotations != nil { + serviceAnnotations := []map[string]interface{}{} + for _, serviceAnnotationsItem := range model.ServiceAnnotations { + serviceAnnotationsItemMap, err := DataSourceIbmBackupRecoveryProtectionSourcesServiceAnnotationsEntryToMap(&serviceAnnotationsItem) // #nosec G601 + if err != nil { + return modelMap, err + } + serviceAnnotations = append(serviceAnnotations, serviceAnnotationsItemMap) + } + modelMap["service_annotations"] = serviceAnnotations + } + if model.StorageClass != nil { + storageClass := []map[string]interface{}{} + for _, storageClassItem := range model.StorageClass { + storageClassItemMap, err := DataSourceIbmBackupRecoveryProtectionSourcesKubernetesStorageClassInfoToMap(&storageClassItem) // #nosec G601 + if err != nil { + return modelMap, err + } + storageClass = append(storageClass, storageClassItemMap) + } + modelMap["storage_class"] = storageClass + } + if model.Type != nil { + modelMap["type"] = *model.Type + } + if model.UUID != nil { + modelMap["uuid"] = *model.UUID + } + if model.VeleroAwsPluginImageLocation != nil { + modelMap["velero_aws_plugin_image_location"] = *model.VeleroAwsPluginImageLocation + } + if model.VeleroImageLocation != nil { + modelMap["velero_image_location"] = *model.VeleroImageLocation + } + if model.VeleroOpenshiftPluginImageLocation != nil { + modelMap["velero_openshift_plugin_image_location"] = *model.VeleroOpenshiftPluginImageLocation + } + if model.VeleroUpgradability != nil { + modelMap["velero_upgradability"] = *model.VeleroUpgradability + } + if model.VlanInfoVec != nil { + vlanInfoVec := []map[string]interface{}{} + for _, vlanInfoVecItem := range model.VlanInfoVec { + vlanInfoVecItemMap, err := DataSourceIbmBackupRecoveryProtectionSourcesKubernetesVlanInfoToMap(&vlanInfoVecItem) // #nosec G601 + if err != nil { + return modelMap, err + } + vlanInfoVec = append(vlanInfoVec, vlanInfoVecItemMap) + } + modelMap["vlan_info_vec"] = vlanInfoVec + } + return modelMap, nil +} + +func DataSourceIbmBackupRecoveryProtectionSourcesVlanParametersToMap(model *backuprecoveryv1.VlanParameters) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.DisableVlan != nil { + modelMap["disable_vlan"] = *model.DisableVlan + } + if model.InterfaceName != nil { + modelMap["interface_name"] = *model.InterfaceName + } + if model.Vlan != nil { + modelMap["vlan"] = flex.IntValue(model.Vlan) + } + return modelMap, nil +} + +func DataSourceIbmBackupRecoveryProtectionSourcesKubernetesLabelAttributeToMap(model *backuprecoveryv1.KubernetesLabelAttribute) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.ID != nil { + modelMap["id"] = flex.IntValue(model.ID) + } + if model.Name != nil { + modelMap["name"] = *model.Name + } + if model.UUID != nil { + modelMap["uuid"] = *model.UUID + } + return modelMap, nil +} + +func DataSourceIbmBackupRecoveryProtectionSourcesK8sLabelToMap(model *backuprecoveryv1.K8sLabel) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Key != nil { + modelMap["key"] = *model.Key + } + if model.Value != nil { + modelMap["value"] = *model.Value + } + return modelMap, nil +} + +func DataSourceIbmBackupRecoveryProtectionSourcesServiceAnnotationsEntryToMap(model *backuprecoveryv1.ServiceAnnotationsEntry) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Key != nil { + modelMap["key"] = *model.Key + } + if model.Value != nil { + modelMap["value"] = *model.Value + } + return modelMap, nil +} + +func DataSourceIbmBackupRecoveryProtectionSourcesKubernetesStorageClassInfoToMap(model *backuprecoveryv1.KubernetesStorageClassInfo) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Name != nil { + modelMap["name"] = *model.Name + } + if model.Provisioner != nil { + modelMap["provisioner"] = *model.Provisioner + } + return modelMap, nil +} + +func DataSourceIbmBackupRecoveryProtectionSourcesKubernetesVlanInfoToMap(model *backuprecoveryv1.KubernetesVlanInfo) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.ServiceAnnotations != nil { + serviceAnnotations := []map[string]interface{}{} + for _, serviceAnnotationsItem := range model.ServiceAnnotations { + serviceAnnotationsItemMap, err := DataSourceIbmBackupRecoveryProtectionSourcesKubernetesServiceAnnotationObjectToMap(&serviceAnnotationsItem) // #nosec G601 + if err != nil { + return modelMap, err + } + serviceAnnotations = append(serviceAnnotations, serviceAnnotationsItemMap) + } + modelMap["service_annotations"] = serviceAnnotations + } + if model.VlanParams != nil { + vlanParamsMap, err := DataSourceIbmBackupRecoveryProtectionSourcesVlanParamsToMap(model.VlanParams) + if err != nil { + return modelMap, err + } + modelMap["vlan_params"] = []map[string]interface{}{vlanParamsMap} + } + return modelMap, nil +} + +func DataSourceIbmBackupRecoveryProtectionSourcesKubernetesServiceAnnotationObjectToMap(model *backuprecoveryv1.KubernetesServiceAnnotationObject) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Key != nil { + modelMap["key"] = *model.Key + } + if model.Value != nil { + modelMap["value"] = *model.Value + } + return modelMap, nil +} + +func DataSourceIbmBackupRecoveryProtectionSourcesVlanParamsToMap(model *backuprecoveryv1.VlanParams) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.DisableVlan != nil { + modelMap["disable_vlan"] = *model.DisableVlan + } + if model.InterfaceName != nil { + modelMap["interface_name"] = *model.InterfaceName + } + if model.VlanID != nil { + modelMap["vlan_id"] = flex.IntValue(model.VlanID) + } + return modelMap, nil +} + func DataSourceIbmBackupRecoveryProtectionSourcesPhysicalProtectionSourceToMap(model *backuprecoveryv1.PhysicalProtectionSource) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.Agents != nil { diff --git a/ibm/service/backuprecovery/data_source_ibm_backup_recovery_source_registration.go b/ibm/service/backuprecovery/data_source_ibm_backup_recovery_source_registration.go index e71bc309fc..7afa0d6170 100644 --- a/ibm/service/backuprecovery/data_source_ibm_backup_recovery_source_registration.go +++ b/ibm/service/backuprecovery/data_source_ibm_backup_recovery_source_registration.go @@ -988,6 +988,11 @@ func DataSourceIbmBackupRecoverySourceRegistration() *schema.Resource { Computed: true, Description: "Specifies the bearer token or private key of Kubernetes source.", }, + "cohesity_dataprotect_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the custom Cohesity Dataprotect plugin image location of the Kubernetes source.", + }, "data_mover_image_location": &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -2065,7 +2070,12 @@ func DataSourceIbmBackupRecoverySourceRegistrationKubernetesSourceRegistrationPa modelMap["auto_protect_config"] = []map[string]interface{}{autoProtectConfigMap} } modelMap["client_private_key"] = *model.ClientPrivateKey - modelMap["data_mover_image_location"] = *model.DataMoverImageLocation + if model.CohesityDataprotectPluginImageLocation != nil { + modelMap["cohesity_dataprotect_plugin_image_location"] = *model.CohesityDataprotectPluginImageLocation + } + if model.DataMoverImageLocation != nil { + modelMap["data_mover_image_location"] = *model.DataMoverImageLocation + } if model.DatamoverServiceType != nil { modelMap["datamover_service_type"] = *model.DatamoverServiceType } diff --git a/ibm/service/backuprecovery/data_source_ibm_backup_recovery_source_registrations.go b/ibm/service/backuprecovery/data_source_ibm_backup_recovery_source_registrations.go index c3e387e20d..ea4f4ccc76 100644 --- a/ibm/service/backuprecovery/data_source_ibm_backup_recovery_source_registrations.go +++ b/ibm/service/backuprecovery/data_source_ibm_backup_recovery_source_registrations.go @@ -1022,6 +1022,11 @@ func DataSourceIbmBackupRecoverySourceRegistrations() *schema.Resource { Computed: true, Description: "Specifies the bearer token or private key of Kubernetes source.", }, + "cohesity_dataprotect_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Specifies the custom Cohesity Dataprotect plugin image location of the Kubernetes source.", + }, "data_mover_image_location": &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -2095,6 +2100,9 @@ func DataSourceIbmBackupRecoverySourceRegistrationsKubernetesSourceRegistrationP if model.ClientPrivateKey != nil { modelMap["client_private_key"] = *model.ClientPrivateKey } + if model.CohesityDataprotectPluginImageLocation != nil { + modelMap["cohesity_dataprotect_plugin_image_location"] = *model.CohesityDataprotectPluginImageLocation + } if model.DataMoverImageLocation != nil { modelMap["data_mover_image_location"] = *model.DataMoverImageLocation } diff --git a/ibm/service/backuprecovery/resource_ibm_backup_recovery.go b/ibm/service/backuprecovery/resource_ibm_backup_recovery.go index 363609296f..285d346b6a 100644 --- a/ibm/service/backuprecovery/resource_ibm_backup_recovery.go +++ b/ibm/service/backuprecovery/resource_ibm_backup_recovery.go @@ -15,12 +15,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + validation "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" "github.com/IBM/go-sdk-core/v5/core" "github.com/IBM/ibm-backup-recovery-sdk-go/backuprecoveryv1" - validation "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) func ResourceIbmBackupRecovery() *schema.Resource { @@ -42,7 +42,7 @@ func ResourceIbmBackupRecovery() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: true, - // ValidateFunc: validate.InvokeValidator("ibm_backup_recovery_recovery", "request_initiator_type"), + // ValidateFunc: validate.InvokeValidator("ibm_backup_recovery", "request_initiator_type"), Description: "Specifies the type of request from UI, which is used for services like magneto to determine the priority of requests.", }, "name": &schema.Schema{ @@ -60,7 +60,7 @@ func ResourceIbmBackupRecovery() *schema.Resource { Type: schema.TypeString, Required: true, // ForceNew: true, - // ValidateFunc: validate.InvokeValidator("ibm_backup_recovery_recovery", "snapshot_environment"), + // ValidateFunc: validate.InvokeValidator("ibm_backup_recovery", "snapshot_environment"), Description: "Specifies the type of snapshot environment for which the Recovery was performed.", }, "physical_params": &schema.Schema{ @@ -2960,13 +2960,66 @@ func ResourceIbmBackupRecovery() *schema.Resource { Description: "Array of objects that are to be included.", Elem: &schema.Schema{Type: schema.TypeInt}, }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Optional: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, }, }, }, "excluded_pvcs": &schema.Schema{ Type: schema.TypeList, Optional: true, - Description: "Specifies the list of pvc to be excluded from recovery.", + Description: "Specifies the list of pvc to be excluded from recovery. This will be deprecated in the future. This is overridden by the object level param.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": &schema.Schema{ @@ -3019,6 +3072,59 @@ func ResourceIbmBackupRecovery() *schema.Resource { Description: "Array of objects that are to be included.", Elem: &schema.Schema{Type: schema.TypeInt}, }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Optional: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, }, }, }, @@ -3574,6 +3680,251 @@ func ResourceIbmBackupRecovery() *schema.Resource { Computed: true, Description: "Specify the total bytes restored.", }, + "exclude_params": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Specifies the parameters to in/exclude objects (e.g.: volumes). An object satisfying any of these criteria will be included by this filter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "label_combination_method": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "Whether to include all the labels or any of them while performing inclusion/exclusion of objects.", + }, + "label_vector": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of Object to represent Label that Specify Objects (e.g.: Persistent Volumes and Persistent Volume Claims) to Include or Exclude.It will be a two-dimensional array, where each inner array will consist of a key and value representing labels. Using this two dimensional array of Labels, the Cluster generates a list of items to include in the filter, which are derived from intersections or the union of these labels, as decided by operation parameter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The key of the label, used to identify the label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The value associated with the label key.", + }, + }, + }, + }, + "objects": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of objects that are to be included.", + Elem: &schema.Schema{Type: schema.TypeInt}, + }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Optional: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, + }, + }, + }, + "include_params": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Specifies the parameters to in/exclude objects (e.g.: volumes). An object satisfying any of these criteria will be included by this filter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "label_combination_method": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "Whether to include all the labels or any of them while performing inclusion/exclusion of objects.", + }, + "label_vector": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of Object to represent Label that Specify Objects (e.g.: Persistent Volumes and Persistent Volume Claims) to Include or Exclude.It will be a two-dimensional array, where each inner array will consist of a key and value representing labels. Using this two dimensional array of Labels, the Cluster generates a list of items to include in the filter, which are derived from intersections or the union of these labels, as decided by operation parameter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The key of the label, used to identify the label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The value associated with the label key.", + }, + }, + }, + }, + "objects": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of objects that are to be included.", + Elem: &schema.Schema{Type: schema.TypeInt}, + }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Optional: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, + }, + }, + }, + "recover_pvcs_only": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Description: "Specifies whether to recover PVCs only during recovery. Default: false.", + }, + "storage_class": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Specifies the storage class parameters for recovery of namespace.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "storage_class_mapping": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Specifies mapping of storage classes.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The key of the label, used to identify the label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The value associated with the label key.", + }, + }, + }, + }, + "use_storage_class_mapping": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Description: "Specifies whether or not to use storage class mapping.", + }, + }, + }, + }, + "unbind_pvcs": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Description: "Specifies whether the volume bindings will be removed from all restored PVCs. This will effectively unbind the PVCs from their original PVs. Default: false.", + }, + }, + }, + }, + "recover_cluster_scoped_resources": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Specifies the parameters from where the cluster scoped resources would be recovered.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "snapshot_id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "Specifies the snapshot id of the namespace from where the cluster scoped resources are to be recovered.", + }, }, }, }, @@ -3609,7 +3960,27 @@ func ResourceIbmBackupRecovery() *schema.Resource { "recover_pvcs_only": &schema.Schema{ Type: schema.TypeBool, Optional: true, - Description: "Specifies whether to recover PVCs only during recovery.", + Description: "Specifies whether to recover PVCs only during recovery.. This is overridden with the object level settings and will be deprecated in the future.", + }, + "recovery_region_migration_params": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Specifies an individual migration rule for mapping a region/zone to another for cross region recovery.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "current_value": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "Specifies the current value for the mapping that needs to be mutated.", + }, + "new_value": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "Specifies the new value for the mapping with which the fields need to be updated with.", + }, + }, + }, }, "recovery_target_config": &schema.Schema{ Type: schema.TypeList, @@ -3659,6 +4030,25 @@ func ResourceIbmBackupRecovery() *schema.Resource { }, }, }, + "recovery_zone_migration_params": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Specifies rules for performing zone migrations during recovery. Used in case of recovery to new location and the namespace being recovered is in a different zone.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "current_value": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "Specifies the current value for the mapping that needs to be mutated.", + }, + "new_value": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "Specifies the new value for the mapping with which the fields need to be updated with.", + }, + }, + }, + }, "rename_recovered_namespaces_params": &schema.Schema{ Type: schema.TypeList, MaxItems: 1, @@ -5530,9 +5920,9 @@ func ResourceIbmBackupRecoveryMapToRecoverKubernetesNamespaceParamsKubernetesTar model.IncludeParams = IncludeParamsModel } if modelMap["objects"] != nil { - objects := []backuprecoveryv1.CommonRecoverObjectSnapshotParams{} + objects := []backuprecoveryv1.KubernetesRecoveryObjectParams{} for _, objectsItem := range modelMap["objects"].([]interface{}) { - objectsItemModel, err := ResourceIbmBackupRecoveryMapToCommonRecoverObjectSnapshotParams(objectsItem.(map[string]interface{})) + objectsItemModel, err := ResourceIbmBackupRecoveryMapToKubernetesRecoveryObjectParams(objectsItem.(map[string]interface{})) if err != nil { return model, err } @@ -5540,6 +5930,13 @@ func ResourceIbmBackupRecoveryMapToRecoverKubernetesNamespaceParamsKubernetesTar } model.Objects = objects } + if modelMap["recover_cluster_scoped_resources"] != nil && len(modelMap["recover_cluster_scoped_resources"].([]interface{})) > 0 { + RecoverClusterScopedResourcesModel, err := ResourceIbmBackupRecoveryMapToRecoverClusterScopedResourcesParams(modelMap["recover_cluster_scoped_resources"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.RecoverClusterScopedResources = RecoverClusterScopedResourcesModel + } if modelMap["recover_protection_group_runs_params"] != nil { recoverProtectionGroupRunsParams := []backuprecoveryv1.RecoverProtectionGroupRunParams{} for _, recoverProtectionGroupRunsParamsItem := range modelMap["recover_protection_group_runs_params"].([]interface{}) { @@ -5554,11 +5951,29 @@ func ResourceIbmBackupRecoveryMapToRecoverKubernetesNamespaceParamsKubernetesTar if modelMap["recover_pvcs_only"] != nil { model.RecoverPvcsOnly = core.BoolPtr(modelMap["recover_pvcs_only"].(bool)) } + if modelMap["recovery_region_migration_params"] != nil && len(modelMap["recovery_region_migration_params"].([]interface{})) > 0 { + RecoveryRegionMigrationParamsModel, err := ResourceIbmBackupRecoveryMapToKubernetesRecoveryMigrationParams(modelMap["recovery_region_migration_params"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.RecoveryRegionMigrationParams = RecoveryRegionMigrationParamsModel + } RecoveryTargetConfigModel, err := ResourceIbmBackupRecoveryMapToKubernetesTargetParamsForRecoverKubernetesNamespaceRecoveryTargetConfig(modelMap["recovery_target_config"].([]interface{})[0].(map[string]interface{})) if err != nil { return model, err } model.RecoveryTargetConfig = RecoveryTargetConfigModel + if modelMap["recovery_zone_migration_params"] != nil { + recoveryZoneMigrationParams := []backuprecoveryv1.KubernetesRecoveryMigrationParams{} + for _, recoveryZoneMigrationParamsItem := range modelMap["recovery_zone_migration_params"].([]interface{}) { + recoveryZoneMigrationParamsItemModel, err := ResourceIbmBackupRecoveryMapToKubernetesRecoveryMigrationParams(recoveryZoneMigrationParamsItem.(map[string]interface{})) + if err != nil { + return model, err + } + recoveryZoneMigrationParams = append(recoveryZoneMigrationParams, *recoveryZoneMigrationParamsItemModel) + } + model.RecoveryZoneMigrationParams = recoveryZoneMigrationParams + } if modelMap["rename_recovered_namespaces_params"] != nil && len(modelMap["rename_recovered_namespaces_params"].([]interface{})) > 0 { RenameRecoveredNamespacesParamsModel, err := ResourceIbmBackupRecoveryMapToKubernetesTargetParamsForRecoverKubernetesNamespaceRenameRecoveredNamespacesParams(modelMap["rename_recovered_namespaces_params"].([]interface{})[0].(map[string]interface{})) if err != nil { @@ -5602,6 +6017,17 @@ func ResourceIbmBackupRecoveryMapToKubernetesFilterParams(modelMap map[string]in } model.Objects = objects } + if modelMap["selected_resources"] != nil { + selectedResources := []backuprecoveryv1.ResourceInfo{} + for _, selectedResourcesItem := range modelMap["selected_resources"].([]interface{}) { + selectedResourcesItemModel, err := ResourceIbmBackupRecoveryMapToResourceInfo(selectedResourcesItem.(map[string]interface{})) + if err != nil { + return model, err + } + selectedResources = append(selectedResources, *selectedResourcesItemModel) + } + model.SelectedResources = selectedResources + } return model, nil } @@ -5616,6 +6042,48 @@ func ResourceIbmBackupRecoveryMapToKubernetesLabel(modelMap map[string]interface return model, nil } +func ResourceIbmBackupRecoveryMapToResourceInfo(modelMap map[string]interface{}) (*backuprecoveryv1.ResourceInfo, error) { + model := &backuprecoveryv1.ResourceInfo{} + if modelMap["api_group"] != nil { + model.ApiGroup = core.StringPtr(modelMap["api_group"].(string)) + } + if modelMap["is_cluster_scoped"] != nil { + model.IsClusterScoped = core.BoolPtr(modelMap["is_cluster_scoped"].(bool)) + } + if modelMap["kind"] != nil && modelMap["kind"].(string) != "" { + model.Kind = core.StringPtr(modelMap["kind"].(string)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + if modelMap["resource_list"] != nil { + resourceList := []backuprecoveryv1.ResourceInstance{} + for _, resourceListItem := range modelMap["resource_list"].([]interface{}) { + resourceListItemModel, err := ResourceIbmBackupRecoveryMapToResourceInstance(resourceListItem.(map[string]interface{})) + if err != nil { + return model, err + } + resourceList = append(resourceList, *resourceListItemModel) + } + model.ResourceList = resourceList + } + if modelMap["version"] != nil && modelMap["version"].(string) != "" { + model.Version = core.StringPtr(modelMap["version"].(string)) + } + return model, nil +} + +func ResourceIbmBackupRecoveryMapToResourceInstance(modelMap map[string]interface{}) (*backuprecoveryv1.ResourceInstance, error) { + model := &backuprecoveryv1.ResourceInstance{} + if modelMap["entity_id"] != nil && modelMap["entity_id"].(int) != 0 { + model.EntityID = core.Int64Ptr(int64(modelMap["entity_id"].(int))) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + return model, nil +} + func ResourceIbmBackupRecoveryMapToKubernetesPvcInfo(modelMap map[string]interface{}) (*backuprecoveryv1.KubernetesPvcInfo, error) { model := &backuprecoveryv1.KubernetesPvcInfo{} if modelMap["id"] != nil { @@ -5627,6 +6095,108 @@ func ResourceIbmBackupRecoveryMapToKubernetesPvcInfo(modelMap map[string]interfa return model, nil } +func ResourceIbmBackupRecoveryMapToKubernetesRecoveryObjectParams(modelMap map[string]interface{}) (*backuprecoveryv1.KubernetesRecoveryObjectParams, error) { + model := &backuprecoveryv1.KubernetesRecoveryObjectParams{} + model.SnapshotID = core.StringPtr(modelMap["snapshot_id"].(string)) + if modelMap["point_in_time_usecs"] != nil && modelMap["point_in_time_usecs"].(int) != 0 { + model.PointInTimeUsecs = core.Int64Ptr(int64(modelMap["point_in_time_usecs"].(int))) + } + if modelMap["protection_group_id"] != nil && modelMap["protection_group_id"].(string) != "" { + model.ProtectionGroupID = core.StringPtr(modelMap["protection_group_id"].(string)) + } + if modelMap["protection_group_name"] != nil && modelMap["protection_group_name"].(string) != "" { + model.ProtectionGroupName = core.StringPtr(modelMap["protection_group_name"].(string)) + } + if modelMap["snapshot_creation_time_usecs"] != nil { + model.SnapshotCreationTimeUsecs = core.Int64Ptr(int64(modelMap["snapshot_creation_time_usecs"].(int))) + } + if modelMap["object_info"] != nil && len(modelMap["object_info"].([]interface{})) > 0 { + ObjectInfoModel, err := ResourceIbmBackupRecoveryMapToCommonRecoverObjectSnapshotParamsObjectInfo(modelMap["object_info"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.ObjectInfo = ObjectInfoModel + } + if modelMap["snapshot_target_type"] != nil && modelMap["snapshot_target_type"].(string) != "" { + model.SnapshotTargetType = core.StringPtr(modelMap["snapshot_target_type"].(string)) + } + if modelMap["archival_target_info"] != nil && len(modelMap["archival_target_info"].([]interface{})) > 0 { + ArchivalTargetInfoModel, err := ResourceIbmBackupRecoveryMapToCommonRecoverObjectSnapshotParamsArchivalTargetInfo(modelMap["archival_target_info"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.ArchivalTargetInfo = ArchivalTargetInfoModel + } + if modelMap["progress_task_id"] != nil && modelMap["progress_task_id"].(string) != "" { + model.ProgressTaskID = core.StringPtr(modelMap["progress_task_id"].(string)) + } + if modelMap["recover_from_standby"] != nil { + model.RecoverFromStandby = core.BoolPtr(modelMap["recover_from_standby"].(bool)) + } + if modelMap["status"] != nil && modelMap["status"].(string) != "" { + model.Status = core.StringPtr(modelMap["status"].(string)) + } + if modelMap["start_time_usecs"] != nil { + model.StartTimeUsecs = core.Int64Ptr(int64(modelMap["start_time_usecs"].(int))) + } + if modelMap["end_time_usecs"] != nil { + model.EndTimeUsecs = core.Int64Ptr(int64(modelMap["end_time_usecs"].(int))) + } + if modelMap["messages"] != nil { + messages := []string{} + for _, messagesItem := range modelMap["messages"].([]interface{}) { + messages = append(messages, messagesItem.(string)) + } + model.Messages = messages + } + if modelMap["bytes_restored"] != nil { + model.BytesRestored = core.Int64Ptr(int64(modelMap["bytes_restored"].(int))) + } + if modelMap["exclude_params"] != nil && len(modelMap["exclude_params"].([]interface{})) > 0 { + ExcludeParamsModel, err := ResourceIbmBackupRecoveryMapToKubernetesFilterParams(modelMap["exclude_params"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.ExcludeParams = ExcludeParamsModel + } + if modelMap["include_params"] != nil && len(modelMap["include_params"].([]interface{})) > 0 { + IncludeParamsModel, err := ResourceIbmBackupRecoveryMapToKubernetesFilterParams(modelMap["include_params"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.IncludeParams = IncludeParamsModel + } + if modelMap["recover_pvcs_only"] != nil { + model.RecoverPvcsOnly = core.BoolPtr(modelMap["recover_pvcs_only"].(bool)) + } + if modelMap["storage_class"] != nil && len(modelMap["storage_class"].([]interface{})) > 0 { + StorageClassModel, err := ResourceIbmBackupRecoveryMapToKubernetesStorageClassParams(modelMap["storage_class"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.StorageClass = StorageClassModel + } + if modelMap["unbind_pvcs"] != nil { + model.UnbindPvcs = core.BoolPtr(modelMap["unbind_pvcs"].(bool)) + } + return model, nil +} + +func ResourceIbmBackupRecoveryMapToRecoverClusterScopedResourcesParams(modelMap map[string]interface{}) (*backuprecoveryv1.RecoverClusterScopedResourcesParams, error) { + model := &backuprecoveryv1.RecoverClusterScopedResourcesParams{} + if modelMap["snapshot_id"] != nil && modelMap["snapshot_id"].(string) != "" { + model.SnapshotID = core.StringPtr(modelMap["snapshot_id"].(string)) + } + return model, nil +} + +func ResourceIbmBackupRecoveryMapToKubernetesRecoveryMigrationParams(modelMap map[string]interface{}) (*backuprecoveryv1.KubernetesRecoveryMigrationParams, error) { + model := &backuprecoveryv1.KubernetesRecoveryMigrationParams{} + model.CurrentValue = core.StringPtr(modelMap["current_value"].(string)) + model.NewValue = core.StringPtr(modelMap["new_value"].(string)) + return model, nil +} + func ResourceIbmBackupRecoveryMapToRecoverProtectionGroupRunParams(modelMap map[string]interface{}) (*backuprecoveryv1.RecoverProtectionGroupRunParams, error) { model := &backuprecoveryv1.RecoverProtectionGroupRunParams{} if modelMap["archival_target_id"] != nil { @@ -5743,7 +6313,7 @@ func ResourceIbmBackupRecoveryMapToRecoverSqlParams(modelMap map[string]interfac func ResourceIbmBackupRecoveryMapToRecoverSqlAppParams(modelMap map[string]interface{}) (*backuprecoveryv1.RecoverSqlAppParams, error) { model := &backuprecoveryv1.RecoverSqlAppParams{} model.SnapshotID = core.StringPtr(modelMap["snapshot_id"].(string)) - if modelMap["point_in_time_usecs"] != nil { + if modelMap["point_in_time_usecs"] != nil && modelMap["point_in_time_usecs"].(int) != 0 { model.PointInTimeUsecs = core.Int64Ptr(int64(modelMap["point_in_time_usecs"].(int))) } if modelMap["protection_group_id"] != nil && modelMap["protection_group_id"].(string) != "" { @@ -6079,7 +6649,7 @@ func ResourceIbmBackupRecoveryRecoverPhysicalParamsToMap(model *backuprecoveryv1 func ResourceIbmBackupRecoveryCommonRecoverObjectSnapshotParamsToMap(model *backuprecoveryv1.CommonRecoverObjectSnapshotParams) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["snapshot_id"] = *model.SnapshotID - if model.PointInTimeUsecs != nil { + if model.PointInTimeUsecs != nil && *(model.PointInTimeUsecs) != 0 { modelMap["point_in_time_usecs"] = flex.IntValue(model.PointInTimeUsecs) } if model.ProtectionGroupID != nil { @@ -7099,7 +7669,7 @@ func ResourceIbmBackupRecoveryRecoverKubernetesNamespaceParamsKubernetesTargetPa if model.Objects != nil { objects := []map[string]interface{}{} for _, objectsItem := range model.Objects { - objectsItemMap, err := ResourceIbmBackupRecoveryCommonRecoverObjectSnapshotParamsToMap(&objectsItem) // #nosec G601 + objectsItemMap, err := ResourceIbmBackupRecoveryKubernetesRecoveryObjectParamsToMap(&objectsItem) // #nosec G601 if err != nil { return modelMap, err } @@ -7107,6 +7677,13 @@ func ResourceIbmBackupRecoveryRecoverKubernetesNamespaceParamsKubernetesTargetPa } modelMap["objects"] = objects } + if model.RecoverClusterScopedResources != nil { + recoverClusterScopedResourcesMap, err := ResourceIbmBackupRecoveryRecoverClusterScopedResourcesParamsToMap(model.RecoverClusterScopedResources) + if err != nil { + return modelMap, err + } + modelMap["recover_cluster_scoped_resources"] = []map[string]interface{}{recoverClusterScopedResourcesMap} + } if model.RecoverProtectionGroupRunsParams != nil { recoverProtectionGroupRunsParams := []map[string]interface{}{} for _, recoverProtectionGroupRunsParamsItem := range model.RecoverProtectionGroupRunsParams { @@ -7121,11 +7698,29 @@ func ResourceIbmBackupRecoveryRecoverKubernetesNamespaceParamsKubernetesTargetPa if model.RecoverPvcsOnly != nil { modelMap["recover_pvcs_only"] = *model.RecoverPvcsOnly } + if model.RecoveryRegionMigrationParams != nil { + recoveryRegionMigrationParamsMap, err := ResourceIbmBackupRecoveryKubernetesRecoveryMigrationParamsToMap(model.RecoveryRegionMigrationParams) + if err != nil { + return modelMap, err + } + modelMap["recovery_region_migration_params"] = []map[string]interface{}{recoveryRegionMigrationParamsMap} + } recoveryTargetConfigMap, err := ResourceIbmBackupRecoveryKubernetesTargetParamsForRecoverKubernetesNamespaceRecoveryTargetConfigToMap(model.RecoveryTargetConfig) if err != nil { return modelMap, err } modelMap["recovery_target_config"] = []map[string]interface{}{recoveryTargetConfigMap} + if model.RecoveryZoneMigrationParams != nil { + recoveryZoneMigrationParams := []map[string]interface{}{} + for _, recoveryZoneMigrationParamsItem := range model.RecoveryZoneMigrationParams { + recoveryZoneMigrationParamsItemMap, err := ResourceIbmBackupRecoveryKubernetesRecoveryMigrationParamsToMap(&recoveryZoneMigrationParamsItem) // #nosec G601 + if err != nil { + return modelMap, err + } + recoveryZoneMigrationParams = append(recoveryZoneMigrationParams, recoveryZoneMigrationParamsItemMap) + } + modelMap["recovery_zone_migration_params"] = recoveryZoneMigrationParams + } if model.RenameRecoveredNamespacesParams != nil { renameRecoveredNamespacesParamsMap, err := ResourceIbmBackupRecoveryKubernetesTargetParamsForRecoverKubernetesNamespaceRenameRecoveredNamespacesParamsToMap(model.RenameRecoveredNamespacesParams) if err != nil { @@ -7165,6 +7760,17 @@ func ResourceIbmBackupRecoveryKubernetesFilterParamsToMap(model *backuprecoveryv if model.Objects != nil { modelMap["objects"] = model.Objects } + if model.SelectedResources != nil { + selectedResources := []map[string]interface{}{} + for _, selectedResourcesItem := range model.SelectedResources { + selectedResourcesItemMap, err := ResourceIbmBackupRecoveryResourceInfoToMap(&selectedResourcesItem) // #nosec G601 + if err != nil { + return modelMap, err + } + selectedResources = append(selectedResources, selectedResourcesItemMap) + } + modelMap["selected_resources"] = selectedResources + } return modelMap, nil } @@ -7179,6 +7785,48 @@ func ResourceIbmBackupRecoveryKubernetesLabelToMap(model *backuprecoveryv1.Kuber return modelMap, nil } +func ResourceIbmBackupRecoveryResourceInfoToMap(model *backuprecoveryv1.ResourceInfo) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.ApiGroup != nil { + modelMap["api_group"] = *model.ApiGroup + } + if model.IsClusterScoped != nil { + modelMap["is_cluster_scoped"] = *model.IsClusterScoped + } + if model.Kind != nil { + modelMap["kind"] = *model.Kind + } + if model.Name != nil { + modelMap["name"] = *model.Name + } + if model.ResourceList != nil { + resourceList := []map[string]interface{}{} + for _, resourceListItem := range model.ResourceList { + resourceListItemMap, err := ResourceIbmBackupRecoveryResourceInstanceToMap(&resourceListItem) // #nosec G601 + if err != nil { + return modelMap, err + } + resourceList = append(resourceList, resourceListItemMap) + } + modelMap["resource_list"] = resourceList + } + if model.Version != nil { + modelMap["version"] = *model.Version + } + return modelMap, nil +} + +func ResourceIbmBackupRecoveryResourceInstanceToMap(model *backuprecoveryv1.ResourceInstance) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.EntityID != nil && *(model.EntityID) != 0 { + modelMap["entity_id"] = flex.IntValue(model.EntityID) + } + if model.Name != nil { + modelMap["name"] = *model.Name + } + return modelMap, nil +} + func ResourceIbmBackupRecoveryKubernetesPvcInfoToMap(model *backuprecoveryv1.KubernetesPvcInfo) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.ID != nil { @@ -7190,6 +7838,97 @@ func ResourceIbmBackupRecoveryKubernetesPvcInfoToMap(model *backuprecoveryv1.Kub return modelMap, nil } +func ResourceIbmBackupRecoveryKubernetesRecoveryObjectParamsToMap(model *backuprecoveryv1.KubernetesRecoveryObjectParams) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["snapshot_id"] = *model.SnapshotID + if model.PointInTimeUsecs != nil && *(model.PointInTimeUsecs) != 0 { + modelMap["point_in_time_usecs"] = flex.IntValue(model.PointInTimeUsecs) + } + if model.ProtectionGroupID != nil { + modelMap["protection_group_id"] = *model.ProtectionGroupID + } + if model.ProtectionGroupName != nil { + modelMap["protection_group_name"] = *model.ProtectionGroupName + } + if model.SnapshotCreationTimeUsecs != nil { + modelMap["snapshot_creation_time_usecs"] = flex.IntValue(model.SnapshotCreationTimeUsecs) + } + if model.ObjectInfo != nil { + objectInfoMap, err := ResourceIbmBackupRecoveryCommonRecoverObjectSnapshotParamsObjectInfoToMap(model.ObjectInfo) + if err != nil { + return modelMap, err + } + modelMap["object_info"] = []map[string]interface{}{objectInfoMap} + } + if model.SnapshotTargetType != nil { + modelMap["snapshot_target_type"] = *model.SnapshotTargetType + } + if model.ArchivalTargetInfo != nil { + archivalTargetInfoMap, err := ResourceIbmBackupRecoveryCommonRecoverObjectSnapshotParamsArchivalTargetInfoToMap(model.ArchivalTargetInfo) + if err != nil { + return modelMap, err + } + modelMap["archival_target_info"] = []map[string]interface{}{archivalTargetInfoMap} + } + if model.ProgressTaskID != nil { + modelMap["progress_task_id"] = *model.ProgressTaskID + } + if model.RecoverFromStandby != nil { + modelMap["recover_from_standby"] = *model.RecoverFromStandby + } + if model.Status != nil { + modelMap["status"] = *model.Status + } + if model.StartTimeUsecs != nil { + modelMap["start_time_usecs"] = flex.IntValue(model.StartTimeUsecs) + } + if model.EndTimeUsecs != nil { + modelMap["end_time_usecs"] = flex.IntValue(model.EndTimeUsecs) + } + if model.Messages != nil { + modelMap["messages"] = model.Messages + } + if model.BytesRestored != nil { + modelMap["bytes_restored"] = flex.IntValue(model.BytesRestored) + } + if model.ExcludeParams != nil { + excludeParamsMap, err := ResourceIbmBackupRecoveryKubernetesFilterParamsToMap(model.ExcludeParams) + if err != nil { + return modelMap, err + } + modelMap["exclude_params"] = []map[string]interface{}{excludeParamsMap} + } + if model.IncludeParams != nil { + includeParamsMap, err := ResourceIbmBackupRecoveryKubernetesFilterParamsToMap(model.IncludeParams) + if err != nil { + return modelMap, err + } + modelMap["include_params"] = []map[string]interface{}{includeParamsMap} + } + if model.RecoverPvcsOnly != nil { + modelMap["recover_pvcs_only"] = *model.RecoverPvcsOnly + } + if model.StorageClass != nil { + storageClassMap, err := ResourceIbmBackupRecoveryKubernetesStorageClassParamsToMap(model.StorageClass) + if err != nil { + return modelMap, err + } + modelMap["storage_class"] = []map[string]interface{}{storageClassMap} + } + if model.UnbindPvcs != nil { + modelMap["unbind_pvcs"] = *model.UnbindPvcs + } + return modelMap, nil +} + +func ResourceIbmBackupRecoveryRecoverClusterScopedResourcesParamsToMap(model *backuprecoveryv1.RecoverClusterScopedResourcesParams) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.SnapshotID != nil { + modelMap["snapshot_id"] = *model.SnapshotID + } + return modelMap, nil +} + func ResourceIbmBackupRecoveryRecoverProtectionGroupRunParamsToMap(model *backuprecoveryv1.RecoverProtectionGroupRunParams) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.ArchivalTargetID != nil { @@ -7203,6 +7942,13 @@ func ResourceIbmBackupRecoveryRecoverProtectionGroupRunParamsToMap(model *backup return modelMap, nil } +func ResourceIbmBackupRecoveryKubernetesRecoveryMigrationParamsToMap(model *backuprecoveryv1.KubernetesRecoveryMigrationParams) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["current_value"] = *model.CurrentValue + modelMap["new_value"] = *model.NewValue + return modelMap, nil +} + func ResourceIbmBackupRecoveryKubernetesTargetParamsForRecoverKubernetesNamespaceRecoveryTargetConfigToMap(model *backuprecoveryv1.KubernetesTargetParamsForRecoverKubernetesNamespaceRecoveryTargetConfig) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.NewSourceConfig != nil { diff --git a/ibm/service/backuprecovery/resource_ibm_backup_recovery_protection_group.go b/ibm/service/backuprecovery/resource_ibm_backup_recovery_protection_group.go index 02aea3be5a..f2ca35e512 100644 --- a/ibm/service/backuprecovery/resource_ibm_backup_recovery_protection_group.go +++ b/ibm/service/backuprecovery/resource_ibm_backup_recovery_protection_group.go @@ -18,6 +18,7 @@ import ( "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" "github.com/IBM/go-sdk-core/v5/core" "github.com/IBM/ibm-backup-recovery-sdk-go/backuprecoveryv1" ) @@ -1475,6 +1476,59 @@ func ResourceIbmBackupRecoveryProtectionGroup() *schema.Resource { Description: "Array of objects that are to be included.", Elem: &schema.Schema{Type: schema.TypeInt}, }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Optional: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, }, }, }, @@ -1515,6 +1569,59 @@ func ResourceIbmBackupRecoveryProtectionGroup() *schema.Resource { Description: "Array of objects that are to be included.", Elem: &schema.Schema{Type: schema.TypeInt}, }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Optional: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, }, }, }, @@ -1545,6 +1652,99 @@ func ResourceIbmBackupRecoveryProtectionGroup() *schema.Resource { Optional: true, Description: "Specifies whether to backup pvc and related resources only.", }, + "exclude_params": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Specifies the parameters to in/exclude objects (e.g.: volumes). An object satisfying any of these criteria will be included by this filter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "label_combination_method": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "Whether to include all the labels or any of them while performing inclusion/exclusion of objects.", + }, + "label_vector": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of Object to represent Label that Specify Objects (e.g.: Persistent Volumes and Persistent Volume Claims) to Include or Exclude.It will be a two-dimensional array, where each inner array will consist of a key and value representing labels. Using this two dimensional array of Labels, the Cluster generates a list of items to include in the filter, which are derived from intersections or the union of these labels, as decided by operation parameter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The key of the label, used to identify the label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The value associated with the label key.", + }, + }, + }, + }, + "objects": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of objects that are to be included.", + Elem: &schema.Schema{Type: schema.TypeInt}, + }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Optional: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, + }, + }, + }, "exclude_pvcs": &schema.Schema{ Type: schema.TypeList, Optional: true, @@ -1570,11 +1770,109 @@ func ResourceIbmBackupRecoveryProtectionGroup() *schema.Resource { Description: "Specifies the resources to exclude during backup.", Elem: &schema.Schema{Type: schema.TypeString}, }, + "fail_backup_on_hook_failure": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Description: "If true, fail backups when quiesce hook executions fail.", + }, "id": &schema.Schema{ Type: schema.TypeInt, Required: true, Description: "Specifies the id of the object.", }, + "include_params": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Specifies the parameters to in/exclude objects (e.g.: volumes). An object satisfying any of these criteria will be included by this filter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "label_combination_method": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "Whether to include all the labels or any of them while performing inclusion/exclusion of objects.", + }, + "label_vector": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of Object to represent Label that Specify Objects (e.g.: Persistent Volumes and Persistent Volume Claims) to Include or Exclude.It will be a two-dimensional array, where each inner array will consist of a key and value representing labels. Using this two dimensional array of Labels, the Cluster generates a list of items to include in the filter, which are derived from intersections or the union of these labels, as decided by operation parameter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The key of the label, used to identify the label.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The value associated with the label key.", + }, + }, + }, + }, + "objects": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of objects that are to be included.", + Elem: &schema.Schema{Type: schema.TypeInt}, + }, + "selected_resources": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of Object which has group, version, kind, etc. as its fields to identify a resource type and a resource list which is essentially the list of instances of that resource type.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "api_group": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "API group name of the resource (excluding the version). (Eg. apps, kubevirt.io).", + }, + "is_cluster_scoped": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Description: "Boolean indicating whether the resource is cluster scoped or not. This field is ignored for resource selection during recovery.", + }, + "kind": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The kind of the resource type. (Eg. VirtualMachine).", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the resource. This field is ignored for resource selection during recovery.", + }, + "resource_list": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "Array of the instances of the resource with group, version and kind mentioned above.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "entity_id": &schema.Schema{ + Type: schema.TypeInt, + Optional: true, + Description: "The id of the specific entity to be backed up or restored.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The name of the specific entity/resource to be backed up or restored.", + }, + }, + }, + }, + "version": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The version under the API group for the resource. This field is ignored for resource selection during recovery.", + }, + }, + }, + }, + }, + }, + }, "include_pvcs": &schema.Schema{ Type: schema.TypeList, Optional: true, @@ -1584,11 +1882,13 @@ func ResourceIbmBackupRecoveryProtectionGroup() *schema.Resource { "id": &schema.Schema{ Type: schema.TypeInt, Computed: true, + Optional: true, Description: "Specifies the id of the pvc.", }, "name": &schema.Schema{ Type: schema.TypeString, Computed: true, + Optional: true, Description: "Name of the pvc.", }, }, @@ -1631,11 +1931,13 @@ func ResourceIbmBackupRecoveryProtectionGroup() *schema.Resource { "key": &schema.Schema{ Type: schema.TypeString, Computed: true, + Optional: true, Description: "The key of the label, used to identify the label.", }, "value": &schema.Schema{ Type: schema.TypeString, Computed: true, + Optional: true, Description: "The value associated with the label key.", }, }, @@ -5411,6 +5713,36 @@ func ResourceIbmBackupRecoveryProtectionGroup() *schema.Resource { } } +func ResourceIbmBackupRecoveryProtectionGroupValidator() *validate.ResourceValidator { + validateSchema := make([]validate.ValidateSchema, 0) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: "priority", + ValidateFunctionIdentifier: validate.ValidateAllowedStringValue, + Type: validate.TypeString, + Optional: true, + AllowedValues: "kHigh, kLow, kMedium", + }, + validate.ValidateSchema{ + Identifier: "qos_policy", + ValidateFunctionIdentifier: validate.ValidateAllowedStringValue, + Type: validate.TypeString, + Optional: true, + AllowedValues: "kBackupAll, kBackupHDD, kBackupSSD, kTestAndDevHigh", + }, + validate.ValidateSchema{ + Identifier: "environment", + ValidateFunctionIdentifier: validate.ValidateAllowedStringValue, + Type: validate.TypeString, + Required: true, + AllowedValues: "kKubernetes, kPhysical, kSQL", + }, + ) + + resourceValidator := validate.ResourceValidator{ResourceName: "ibm_backup_recovery_protection_group", Schema: validateSchema} + return &resourceValidator +} + func resourceIbmBackupRecoveryProtectionGroupCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { backupRecoveryClient, err := meta.(conns.ClientSession).BackupRecoveryV1() if err != nil { @@ -6883,6 +7215,17 @@ func ResourceIbmBackupRecoveryProtectionGroupMapToKubernetesFilterParams(modelMa } model.Objects = objects } + if modelMap["selected_resources"] != nil { + selectedResources := []backuprecoveryv1.ResourceInfo{} + for _, selectedResourcesItem := range modelMap["selected_resources"].([]interface{}) { + selectedResourcesItemModel, err := ResourceIbmBackupRecoveryProtectionGroupMapToResourceInfo(selectedResourcesItem.(map[string]interface{})) + if err != nil { + return model, err + } + selectedResources = append(selectedResources, *selectedResourcesItemModel) + } + model.SelectedResources = selectedResources + } return model, nil } @@ -6897,11 +7240,60 @@ func ResourceIbmBackupRecoveryProtectionGroupMapToKubernetesLabel(modelMap map[s return model, nil } +func ResourceIbmBackupRecoveryProtectionGroupMapToResourceInfo(modelMap map[string]interface{}) (*backuprecoveryv1.ResourceInfo, error) { + model := &backuprecoveryv1.ResourceInfo{} + if modelMap["api_group"] != nil && modelMap["api_group"].(string) != "" { + model.ApiGroup = core.StringPtr(modelMap["api_group"].(string)) + } + if modelMap["is_cluster_scoped"] != nil { + model.IsClusterScoped = core.BoolPtr(modelMap["is_cluster_scoped"].(bool)) + } + if modelMap["kind"] != nil && modelMap["kind"].(string) != "" { + model.Kind = core.StringPtr(modelMap["kind"].(string)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + if modelMap["resource_list"] != nil { + resourceList := []backuprecoveryv1.ResourceInstance{} + for _, resourceListItem := range modelMap["resource_list"].([]interface{}) { + resourceListItemModel, err := ResourceIbmBackupRecoveryProtectionGroupMapToResourceInstance(resourceListItem.(map[string]interface{})) + if err != nil { + return model, err + } + resourceList = append(resourceList, *resourceListItemModel) + } + model.ResourceList = resourceList + } + if modelMap["version"] != nil && modelMap["version"].(string) != "" { + model.Version = core.StringPtr(modelMap["version"].(string)) + } + return model, nil +} + +func ResourceIbmBackupRecoveryProtectionGroupMapToResourceInstance(modelMap map[string]interface{}) (*backuprecoveryv1.ResourceInstance, error) { + model := &backuprecoveryv1.ResourceInstance{} + if modelMap["entity_id"] != nil { + model.EntityID = core.Int64Ptr(int64(modelMap["entity_id"].(int))) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + return model, nil +} + func ResourceIbmBackupRecoveryProtectionGroupMapToKubernetesProtectionGroupObjectParams(modelMap map[string]interface{}) (*backuprecoveryv1.KubernetesProtectionGroupObjectParams, error) { model := &backuprecoveryv1.KubernetesProtectionGroupObjectParams{} if modelMap["backup_only_pvc"] != nil { model.BackupOnlyPvc = core.BoolPtr(modelMap["backup_only_pvc"].(bool)) } + if modelMap["exclude_params"] != nil && len(modelMap["exclude_params"].([]interface{})) > 0 { + ExcludeParamsModel, err := ResourceIbmBackupRecoveryProtectionGroupMapToKubernetesFilterParams(modelMap["exclude_params"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.ExcludeParams = ExcludeParamsModel + } if modelMap["exclude_pvcs"] != nil { excludePvcs := []backuprecoveryv1.KubernetesPvcInfo{} for _, excludePvcsItem := range modelMap["exclude_pvcs"].([]interface{}) { @@ -6920,7 +7312,17 @@ func ResourceIbmBackupRecoveryProtectionGroupMapToKubernetesProtectionGroupObjec } model.ExcludedResources = excludedResources } + if modelMap["fail_backup_on_hook_failure"] != nil { + model.FailBackupOnHookFailure = core.BoolPtr(modelMap["fail_backup_on_hook_failure"].(bool)) + } model.ID = core.Int64Ptr(int64(modelMap["id"].(int))) + if modelMap["include_params"] != nil && len(modelMap["include_params"].([]interface{})) > 0 { + IncludeParamsModel, err := ResourceIbmBackupRecoveryProtectionGroupMapToKubernetesFilterParams(modelMap["include_params"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.IncludeParams = IncludeParamsModel + } if modelMap["include_pvcs"] != nil { includePvcs := []backuprecoveryv1.KubernetesPvcInfo{} for _, includePvcsItem := range modelMap["include_pvcs"].([]interface{}) { @@ -7029,7 +7431,7 @@ func ResourceIbmBackupRecoveryProtectionGroupMapToKubernetesHook(modelMap map[st if modelMap["fail_on_error"] != nil { model.FailOnError = core.BoolPtr(modelMap["fail_on_error"].(bool)) } - if modelMap["timeout"] != nil { + if modelMap["timeout"] != nil && modelMap["timeout"].(int) != 0 { model.Timeout = core.Int64Ptr(int64(modelMap["timeout"].(int))) } return model, nil @@ -7827,6 +8229,17 @@ func ResourceIbmBackupRecoveryProtectionGroupKubernetesFilterParamsToMap(model * if model.Objects != nil { modelMap["objects"] = model.Objects } + if model.SelectedResources != nil { + selectedResources := []map[string]interface{}{} + for _, selectedResourcesItem := range model.SelectedResources { + selectedResourcesItemMap, err := ResourceIbmBackupRecoveryProtectionGroupResourceInfoToMap(&selectedResourcesItem) // #nosec G601 + if err != nil { + return modelMap, err + } + selectedResources = append(selectedResources, selectedResourcesItemMap) + } + modelMap["selected_resources"] = selectedResources + } return modelMap, nil } @@ -7841,11 +8254,60 @@ func ResourceIbmBackupRecoveryProtectionGroupKubernetesLabelToMap(model *backupr return modelMap, nil } +func ResourceIbmBackupRecoveryProtectionGroupResourceInfoToMap(model *backuprecoveryv1.ResourceInfo) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.ApiGroup != nil { + modelMap["api_group"] = *model.ApiGroup + } + if model.IsClusterScoped != nil { + modelMap["is_cluster_scoped"] = *model.IsClusterScoped + } + if model.Kind != nil { + modelMap["kind"] = *model.Kind + } + if model.Name != nil { + modelMap["name"] = *model.Name + } + if model.ResourceList != nil { + resourceList := []map[string]interface{}{} + for _, resourceListItem := range model.ResourceList { + resourceListItemMap, err := ResourceIbmBackupRecoveryProtectionGroupResourceInstanceToMap(&resourceListItem) // #nosec G601 + if err != nil { + return modelMap, err + } + resourceList = append(resourceList, resourceListItemMap) + } + modelMap["resource_list"] = resourceList + } + if model.Version != nil { + modelMap["version"] = *model.Version + } + return modelMap, nil +} + +func ResourceIbmBackupRecoveryProtectionGroupResourceInstanceToMap(model *backuprecoveryv1.ResourceInstance) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.EntityID != nil { + modelMap["entity_id"] = flex.IntValue(model.EntityID) + } + if model.Name != nil { + modelMap["name"] = *model.Name + } + return modelMap, nil +} + func ResourceIbmBackupRecoveryProtectionGroupKubernetesProtectionGroupObjectParamsToMap(model *backuprecoveryv1.KubernetesProtectionGroupObjectParams) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.BackupOnlyPvc != nil { modelMap["backup_only_pvc"] = *model.BackupOnlyPvc } + if model.ExcludeParams != nil { + excludeParamsMap, err := ResourceIbmBackupRecoveryProtectionGroupKubernetesFilterParamsToMap(model.ExcludeParams) + if err != nil { + return modelMap, err + } + modelMap["exclude_params"] = []map[string]interface{}{excludeParamsMap} + } if model.ExcludePvcs != nil { excludePvcs := []map[string]interface{}{} for _, excludePvcsItem := range model.ExcludePvcs { @@ -7860,7 +8322,17 @@ func ResourceIbmBackupRecoveryProtectionGroupKubernetesProtectionGroupObjectPara if model.ExcludedResources != nil { modelMap["excluded_resources"] = model.ExcludedResources } + if model.FailBackupOnHookFailure != nil { + modelMap["fail_backup_on_hook_failure"] = *model.FailBackupOnHookFailure + } modelMap["id"] = flex.IntValue(model.ID) + if model.IncludeParams != nil { + includeParamsMap, err := ResourceIbmBackupRecoveryProtectionGroupKubernetesFilterParamsToMap(model.IncludeParams) + if err != nil { + return modelMap, err + } + modelMap["include_params"] = []map[string]interface{}{includeParamsMap} + } if model.IncludePvcs != nil { includePvcs := []map[string]interface{}{} for _, includePvcsItem := range model.IncludePvcs { @@ -7961,7 +8433,7 @@ func ResourceIbmBackupRecoveryProtectionGroupKubernetesHookToMap(model *backupre if model.FailOnError != nil { modelMap["fail_on_error"] = *model.FailOnError } - if model.Timeout != nil { + if model.Timeout != nil && *(model.Timeout) != 0 { modelMap["timeout"] = flex.IntValue(model.Timeout) } return modelMap, nil diff --git a/ibm/service/backuprecovery/resource_ibm_backup_recovery_source_registration.go b/ibm/service/backuprecovery/resource_ibm_backup_recovery_source_registration.go index 10b4380fc5..1446aebcac 100644 --- a/ibm/service/backuprecovery/resource_ibm_backup_recovery_source_registration.go +++ b/ibm/service/backuprecovery/resource_ibm_backup_recovery_source_registration.go @@ -216,6 +216,11 @@ func ResourceIbmBackupRecoverySourceRegistration() *schema.Resource { DiffSuppressFunc: suppressParameterDuringRefresh, Description: "Specifies the bearer token or private key of Kubernetes source.", }, + "cohesity_dataprotect_plugin_image_location": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "Specifies the custom Cohesity Dataprotect plugin image location of the Kubernetes source.", + }, "data_mover_image_location": &schema.Schema{ Type: schema.TypeString, Required: true, @@ -1895,6 +1900,9 @@ func ResourceIbmBackupRecoverySourceRegistrationMapToKubernetesSourceRegistratio model.AutoProtectConfig = AutoProtectConfigModel } model.ClientPrivateKey = core.StringPtr(modelMap["client_private_key"].(string)) + if modelMap["cohesity_dataprotect_plugin_image_location"] != nil && modelMap["cohesity_dataprotect_plugin_image_location"].(string) != "" { + model.CohesityDataprotectPluginImageLocation = core.StringPtr(modelMap["cohesity_dataprotect_plugin_image_location"].(string)) + } model.DataMoverImageLocation = core.StringPtr(modelMap["data_mover_image_location"].(string)) if modelMap["datamover_service_type"] != nil && modelMap["datamover_service_type"].(string) != "" { model.DatamoverServiceType = core.StringPtr(modelMap["datamover_service_type"].(string)) @@ -2130,6 +2138,9 @@ func ResourceIbmBackupRecoverySourceRegistrationKubernetesSourceRegistrationPara if model.ClientPrivateKey != nil { modelMap["client_private_key"] = *model.ClientPrivateKey } + if model.CohesityDataprotectPluginImageLocation != nil { + modelMap["cohesity_dataprotect_plugin_image_location"] = *model.CohesityDataprotectPluginImageLocation + } if model.DataMoverImageLocation != nil { modelMap["data_mover_image_location"] = *model.DataMoverImageLocation } From ea8201d321c9bcde3b3f5a28310d09596cecaf7e Mon Sep 17 00:00:00 2001 From: Deeksha Sharma Date: Mon, 1 Dec 2025 12:13:08 +0530 Subject: [PATCH 2/3] update code --- ...source_ibm_backup_recovery_source_registration.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ibm/service/backuprecovery/data_source_ibm_backup_recovery_source_registration.go b/ibm/service/backuprecovery/data_source_ibm_backup_recovery_source_registration.go index 7afa0d6170..675026c698 100644 --- a/ibm/service/backuprecovery/data_source_ibm_backup_recovery_source_registration.go +++ b/ibm/service/backuprecovery/data_source_ibm_backup_recovery_source_registration.go @@ -2069,7 +2069,9 @@ func DataSourceIbmBackupRecoverySourceRegistrationKubernetesSourceRegistrationPa } modelMap["auto_protect_config"] = []map[string]interface{}{autoProtectConfigMap} } - modelMap["client_private_key"] = *model.ClientPrivateKey + if model.ClientPrivateKey != nil { + modelMap["client_private_key"] = *model.ClientPrivateKey + } if model.CohesityDataprotectPluginImageLocation != nil { modelMap["cohesity_dataprotect_plugin_image_location"] = *model.CohesityDataprotectPluginImageLocation } @@ -2086,11 +2088,15 @@ func DataSourceIbmBackupRecoverySourceRegistrationKubernetesSourceRegistrationPa } modelMap["default_vlan_params"] = []map[string]interface{}{defaultVlanParamsMap} } - modelMap["endpoint"] = *model.Endpoint + if model.Endpoint != nil { + modelMap["endpoint"] = *model.Endpoint + } if model.InitContainerImageLocation != nil { modelMap["init_container_image_location"] = *model.InitContainerImageLocation } - modelMap["kubernetes_distribution"] = *model.KubernetesDistribution + if model.KubernetesDistribution != nil { + modelMap["kubernetes_distribution"] = *model.KubernetesDistribution + } if model.KubernetesType != nil { modelMap["kubernetes_type"] = *model.KubernetesType } From f9ac1f05afee7885cccc5e0ebf60bd5f032e91bc Mon Sep 17 00:00:00 2001 From: Deeksha Sharma Date: Mon, 1 Dec 2025 12:41:19 +0530 Subject: [PATCH 3/3] update test case --- ...resource_ibm_backup_recovery_source_registration_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ibm/service/backuprecovery/resource_ibm_backup_recovery_source_registration_test.go b/ibm/service/backuprecovery/resource_ibm_backup_recovery_source_registration_test.go index 9db61a0174..03511a30b5 100644 --- a/ibm/service/backuprecovery/resource_ibm_backup_recovery_source_registration_test.go +++ b/ibm/service/backuprecovery/resource_ibm_backup_recovery_source_registration_test.go @@ -109,8 +109,12 @@ func testAccCheckIbmBackupRecoveryKubernetesSourceRegistrationConfigBasic() stri connection_id = "932952619841170816" name = "terra-iks-registration-1" kubernetes_params { - endpoint = "https://c104-e.us-east.containers.cloud.ibm.com:31410" + endpoint = "https://c104-e.us-east.containers.cloud.ibm.com:30587" kubernetes_distribution = "kIKS" + cohesity_dataprotect_plugin_image_location = "icr.io/ext/brs/cohesity-dataprotect-plugin:7.2.15-p2" + velero_openshift_plugin_image_location = "icr.io/ext/brs/velero-plugin-for-openshift:7.2.15-p2" + velero_image_location = "icr.io/ext/brs/velero:7.2.15-p2" + velero_aws_plugin_image_location = "icr.io/ext/brs/velero-plugin-for-aws:7.2.15-p2" data_mover_image_location = "icr.io/ext/brs/cohesity-datamover:7.2.15-p2" client_private_key = "" }