Skip to content

Commit

Permalink
fix bugs and add resources (#134)
Browse files Browse the repository at this point in the history
* Fix bugs in vpn,exception group and threat exception resources

* change fields from type bool to string in VPN resources
  • Loading branch information
chkp-royl authored Dec 18, 2022
1 parent 0831588 commit e17f3a9
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func dataSourceManagementVpnCommunityMeshed() *schema.Resource {
Description: "The encryption algorithm to be used.",
},
"ike_p1_rekey_time": {
Type: schema.TypeInt,
Type: schema.TypeString,
Computed: true,
Description: "Indicates the time interval for IKE phase 1 renegotiation.",
},
Expand All @@ -87,7 +87,7 @@ func dataSourceManagementVpnCommunityMeshed() *schema.Resource {
Description: "The encryption algorithm to be used.",
},
"ike_p2_use_pfs": {
Type: schema.TypeBool,
Type: schema.TypeString,
Computed: true,
Description: "Indicates whether Perfect Forward Secrecy (PFS) is being used for IKE phase 2.",
},
Expand All @@ -97,7 +97,7 @@ func dataSourceManagementVpnCommunityMeshed() *schema.Resource {
Description: "The Diffie-Hellman group to be used.",
},
"ike_p2_rekey_time": {
Type: schema.TypeInt,
Type: schema.TypeString,
Computed: true,
Description: "Indicates the time interval for IKE phase 2 renegotiation.",
},
Expand Down Expand Up @@ -156,7 +156,7 @@ func dataSourceManagementVpnCommunityMeshed() *schema.Resource {
Schema: map[string]*schema.Schema{
"internal_gateway": {
Type: schema.TypeString,
Computed: true,
Computed: true,
Description: "Internally managed Check Point gateway identified by name or UID, or 'Any' for all internal-gateways participants in this community.",
},
"external_gateway": {
Expand Down Expand Up @@ -196,7 +196,7 @@ func dataSourceManagementVpnCommunityMeshed() *schema.Resource {
Description: "The encryption algorithm to be used.",
},
"ike_p1_rekey_time": {
Type: schema.TypeInt,
Type: schema.TypeString,
Computed: true,
Description: "Indicates the time interval for IKE phase 1 renegotiation.",
},
Expand All @@ -221,7 +221,7 @@ func dataSourceManagementVpnCommunityMeshed() *schema.Resource {
Description: "The encryption algorithm to be used.",
},
"ike_p2_use_pfs": {
Type: schema.TypeBool,
Type: schema.TypeString,
Computed: true,
Description: "Indicates whether Perfect Forward Secrecy (PFS) is being used for IKE phase 2.",
},
Expand All @@ -231,7 +231,7 @@ func dataSourceManagementVpnCommunityMeshed() *schema.Resource {
Description: "The Diffie-Hellman group to be used.",
},
"ike_p2_rekey_time": {
Type: schema.TypeInt,
Type: schema.TypeString,
Computed: true,
Description: "Indicates the time interval for IKE phase 2 renegotiation.",
},
Expand Down Expand Up @@ -344,7 +344,7 @@ func dataSourceManagementVpnCommunityMeshedRead(d *schema.ResourceData, m interf
ikePhase1MapToReturn["encryption_algorithm"] = v
}
if v := ikePhase1Map["ike-p1-rekey-time"]; v != nil {
ikePhase1MapToReturn["ike_p1_rekey_time"] = v
ikePhase1MapToReturn["ike_p1_rekey_time"] = strconv.Itoa(int(v.(float64)))
}
_, ikePhase1InConf := d.GetOk("ike_phase_1")
defaultIkePhase1 := map[string]interface{}{"encryption_algorithm": "aes-256", "diffie_hellman_group": "group-2", "data_integrity": "sha1"}
Expand All @@ -371,13 +371,13 @@ func dataSourceManagementVpnCommunityMeshedRead(d *schema.ResourceData, m interf
ikePhase2MapToReturn["encryption_algorithm"] = v
}
if v := ikePhase2Map["ike-p2-use-pfs"]; v != nil {
ikePhase2MapToReturn["ike_p2_use_pfs"] = v
ikePhase2MapToReturn["ike_p2_use_pfs"] = strconv.FormatBool(v.(bool))
}
if v := ikePhase2Map["ike-p2-pfs-dh-grp"]; v != nil {
ikePhase2MapToReturn["ike_p2_pfs_dh_grp"] = v
}
if v := ikePhase2Map["ike-p2-rekey-time"]; v != nil {
ikePhase2MapToReturn["ike_p2_rekey_time"] = v
ikePhase2MapToReturn["ike_p2_rekey_time"] = strconv.Itoa(int(v.(float64)))
}
_, ikePhase2InConf := d.GetOk("ike_phase_2")
defaultIkePhase2 := map[string]interface{}{"encryption_algorithm": "aes-128", "data_integrity": "sha1"}
Expand Down Expand Up @@ -411,7 +411,7 @@ func dataSourceManagementVpnCommunityMeshedRead(d *schema.ResourceData, m interf
}
}
_ = d.Set("override_vpn_domains", overrideVpnDomainsListToReturn)
}else{
} else {
_ = d.Set("override_vpn_domains", nil)
}

Expand Down Expand Up @@ -448,7 +448,7 @@ func dataSourceManagementVpnCommunityMeshedRead(d *schema.ResourceData, m interf
}
}
_ = d.Set("shared_secrets", sharedSecretsListToReturn)
}else{
} else {
_ = d.Set("shared_secrets", nil)
}

Expand All @@ -471,7 +471,7 @@ func dataSourceManagementVpnCommunityMeshedRead(d *schema.ResourceData, m interf
if obj["name"] != nil {
internalGatewayName = obj["name"].(string)
}
}else if val, ok := v.(string); ok {
} else if val, ok := v.(string); ok {
internalGatewayName = val
}
granularEncryptionState["internal_gateway"] = internalGatewayName
Expand All @@ -484,7 +484,7 @@ func dataSourceManagementVpnCommunityMeshedRead(d *schema.ResourceData, m interf
if obj["name"] != nil {
externalGatewayName = obj["name"].(string)
}
}else if val, ok := v.(string); ok {
} else if val, ok := v.(string); ok {
externalGatewayName = val
}
granularEncryptionState["external_gateway"] = externalGatewayName
Expand All @@ -511,7 +511,7 @@ func dataSourceManagementVpnCommunityMeshedRead(d *schema.ResourceData, m interf
ikePhase1State["diffie_hellman_group"] = v
}
if v := ikePhase1Show["ike-p1-rekey-time"]; v != nil {
ikePhase1State["ike_p1_rekey_time"] = v
ikePhase1State["ike_p1_rekey_time"] = strconv.Itoa(int(v.(float64)))
}
granularEncryptionState["ike_phase_1"] = ikePhase1State
}
Expand All @@ -526,20 +526,20 @@ func dataSourceManagementVpnCommunityMeshedRead(d *schema.ResourceData, m interf
ikePhase2State["data_integrity"] = v
}
if v := ikePhase2Show["ike-p2-use-pfs"]; v != nil {
ikePhase2State["ike_p2_use_pfs"] = v
ikePhase2State["ike_p2_use_pfs"] = strconv.FormatBool(v.(bool))
}
if v := ikePhase2Show["ike-p2-pfs-dh-grp"]; v != nil {
ikePhase2State["ike_p2_pfs_dh_grp"] = v
}
if v := ikePhase2Show["ike-p2-rekey-time"]; v != nil {
ikePhase2State["ike_p2_rekey_time"] = v
ikePhase2State["ike_p2_rekey_time"] = strconv.Itoa(int(v.(float64)))
}
granularEncryptionState["ike_phase_2"] = ikePhase2State
}
granularEncryptionsState = append(granularEncryptionsState, granularEncryptionState)
}
_ = d.Set("granular_encryptions", granularEncryptionsState)
}else{
} else {
_ = d.Set("granular_encryptions", nil)
}
}
Expand Down
36 changes: 18 additions & 18 deletions checkpoint/data_source_checkpoint_management_vpn_community_star.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func dataSourceManagementVpnCommunityStar() *schema.Resource {
Description: "The encryption algorithm to be used.",
},
"ike_p1_rekey_time": {
Type: schema.TypeInt,
Type: schema.TypeString,
Computed: true,
Description: "Indicates the time interval for IKE phase 1 renegotiation.",
},
Expand All @@ -87,7 +87,7 @@ func dataSourceManagementVpnCommunityStar() *schema.Resource {
Description: "The encryption algorithm to be used.",
},
"ike_p2_use_pfs": {
Type: schema.TypeBool,
Type: schema.TypeString,
Computed: true,
Description: "Indicates whether Perfect Forward Secrecy (PFS) is being used for IKE phase 2.",
},
Expand All @@ -97,7 +97,7 @@ func dataSourceManagementVpnCommunityStar() *schema.Resource {
Description: "The Diffie-Hellman group to be used.",
},
"ike_p2_rekey_time": {
Type: schema.TypeInt,
Type: schema.TypeString,
Computed: true,
Description: "Indicates the time interval for IKE phase 2 renegotiation.",
},
Expand Down Expand Up @@ -169,7 +169,7 @@ func dataSourceManagementVpnCommunityStar() *schema.Resource {
Schema: map[string]*schema.Schema{
"internal_gateway": {
Type: schema.TypeString,
Computed: true,
Computed: true,
Description: "Internally managed Check Point gateway identified by name or UID, or 'Any' for all internal-gateways participants in this community.",
},
"external_gateway": {
Expand Down Expand Up @@ -209,7 +209,7 @@ func dataSourceManagementVpnCommunityStar() *schema.Resource {
Description: "The encryption algorithm to be used.",
},
"ike_p1_rekey_time": {
Type: schema.TypeInt,
Type: schema.TypeString,
Computed: true,
Description: "Indicates the time interval for IKE phase 1 renegotiation.",
},
Expand All @@ -233,7 +233,7 @@ func dataSourceManagementVpnCommunityStar() *schema.Resource {
Description: "The encryption algorithm to be used.",
},
"ike_p2_use_pfs": {
Type: schema.TypeBool,
Type: schema.TypeString,
Computed: true,
Description: "Indicates whether Perfect Forward Secrecy (PFS) is being used for IKE phase 2.",
},
Expand All @@ -243,7 +243,7 @@ func dataSourceManagementVpnCommunityStar() *schema.Resource {
Description: "The Diffie-Hellman group to be used.",
},
"ike_p2_rekey_time": {
Type: schema.TypeInt,
Type: schema.TypeString,
Computed: true,
Description: "Indicates the time interval for IKE phase 2 renegotiation.",
},
Expand Down Expand Up @@ -355,7 +355,7 @@ func dataSourceManagementVpnCommunityStarRead(d *schema.ResourceData, m interfac
ikePhase1MapToReturn["encryption_algorithm"] = v
}
if v := ikePhase1Map["ike-p1-rekey-time"]; v != nil {
ikePhase1MapToReturn["ike_p1_rekey_time"] = v
ikePhase1MapToReturn["ike_p1_rekey_time"] = strconv.Itoa(int(v.(float64)))
}
_, ikePhase1InConf := d.GetOk("ike_phase_1")
defaultIkePhase1 := map[string]interface{}{"encryption_algorithm": "aes-256", "diffie_hellman_group": "group-2", "data_integrity": "sha1"}
Expand All @@ -382,13 +382,13 @@ func dataSourceManagementVpnCommunityStarRead(d *schema.ResourceData, m interfac
ikePhase2MapToReturn["encryption_algorithm"] = v
}
if v := ikePhase2Map["ike-p2-use-pfs"]; v != nil {
ikePhase2MapToReturn["ike_p2_use_pfs"] = v
ikePhase2MapToReturn["ike_p2_use_pfs"] = strconv.FormatBool(v.(bool))
}
if v := ikePhase2Map["ike-p2-pfs-dh-grp"]; v != nil {
ikePhase2MapToReturn["ike_p2_pfs_dh_grp"] = v
}
if v := ikePhase2Map["ike-p2-rekey-time"]; v != nil {
ikePhase2MapToReturn["ike_p2_rekey_time"] = v
ikePhase2MapToReturn["ike_p2_rekey_time"] = strconv.Itoa(int(v.(float64)))
}
_, ikePhase2InConf := d.GetOk("ike_phase_2")
defaultIkePhase2 := map[string]interface{}{"encryption_algorithm": "aes-128", "data_integrity": "sha1"}
Expand Down Expand Up @@ -426,7 +426,7 @@ func dataSourceManagementVpnCommunityStarRead(d *schema.ResourceData, m interfac
}
}
_ = d.Set("override_vpn_domains", overrideVpnDomainsListToReturn)
}else{
} else {
_ = d.Set("override_vpn_domains", nil)
}

Expand Down Expand Up @@ -479,7 +479,7 @@ func dataSourceManagementVpnCommunityStarRead(d *schema.ResourceData, m interfac
}
}
_ = d.Set("shared_secrets", sharedSecretsListToReturn)
}else{
} else {
_ = d.Set("shared_secrets", nil)
}

Expand All @@ -502,7 +502,7 @@ func dataSourceManagementVpnCommunityStarRead(d *schema.ResourceData, m interfac
if obj["name"] != nil {
internalGatewayName = obj["name"].(string)
}
}else if val, ok := v.(string); ok {
} else if val, ok := v.(string); ok {
internalGatewayName = val
}
granularEncryptionState["internal_gateway"] = internalGatewayName
Expand All @@ -515,7 +515,7 @@ func dataSourceManagementVpnCommunityStarRead(d *schema.ResourceData, m interfac
if obj["name"] != nil {
externalGatewayName = obj["name"].(string)
}
}else if val, ok := v.(string); ok {
} else if val, ok := v.(string); ok {
externalGatewayName = val
}
granularEncryptionState["external_gateway"] = externalGatewayName
Expand All @@ -542,7 +542,7 @@ func dataSourceManagementVpnCommunityStarRead(d *schema.ResourceData, m interfac
ikePhase1State["diffie_hellman_group"] = v
}
if v := ikePhase1Show["ike-p1-rekey-time"]; v != nil {
ikePhase1State["ike_p1_rekey_time"] = v
ikePhase1State["ike_p1_rekey_time"] = strconv.Itoa(int(v.(float64)))
}
granularEncryptionState["ike_phase_1"] = ikePhase1State
}
Expand All @@ -557,20 +557,20 @@ func dataSourceManagementVpnCommunityStarRead(d *schema.ResourceData, m interfac
ikePhase2State["data_integrity"] = v
}
if v := ikePhase2Show["ike-p2-use-pfs"]; v != nil {
ikePhase2State["ike_p2_use_pfs"] = v
ikePhase2State["ike_p2_use_pfs"] = strconv.FormatBool(v.(bool))
}
if v := ikePhase2Show["ike-p2-pfs-dh-grp"]; v != nil {
ikePhase2State["ike_p2_pfs_dh_grp"] = v
}
if v := ikePhase2Show["ike-p2-rekey-time"]; v != nil {
ikePhase2State["ike_p2_rekey_time"] = v
ikePhase2State["ike_p2_rekey_time"] = strconv.Itoa(int(v.(float64)))
}
granularEncryptionState["ike_phase_2"] = ikePhase2State
}
granularEncryptionsState = append(granularEncryptionsState, granularEncryptionState)
}
_ = d.Set("granular_encryptions", granularEncryptionsState)
}else{
} else {
_ = d.Set("granular_encryptions", nil)
}
}
Expand Down
Loading

0 comments on commit e17f3a9

Please sign in to comment.