Skip to content

Commit

Permalink
Update nsg with beta 17 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ismirlia committed Sep 16, 2024
1 parent ae4f8cb commit c080474
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.22.5
require (
github.com/IBM-Cloud/bluemix-go v0.0.0-20240719075425-078fcb3a55be
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113
github.com/IBM-Cloud/power-go-client v1.8.0-beta15
github.com/IBM-Cloud/power-go-client v1.8.0-beta17
github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca
github.com/IBM/appconfiguration-go-admin-sdk v0.3.0
github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ github.com/IBM-Cloud/bluemix-go v0.0.0-20240719075425-078fcb3a55be/go.mod h1:/7h
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113 h1:f2Erqfea1dKpaTFagTJM6W/wnD3JGq/Vn9URh8nuRwk=
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY=
github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs=
github.com/IBM-Cloud/power-go-client v1.8.0-beta15 h1:FmJe3+X8F7VC5kHhBMD69th5fkBvMT0iWiSrTa6xwEQ=
github.com/IBM-Cloud/power-go-client v1.8.0-beta15/go.mod h1:oAkZiHX25cmr2Yun5V0q6CpnUemegvSrpcEy/oQcjzU=
github.com/IBM-Cloud/power-go-client v1.8.0-beta17 h1:zL/qQUs/bb8L0FEazcBcpr7wTCpv0CJp/dbpg6351Qc=
github.com/IBM-Cloud/power-go-client v1.8.0-beta17/go.mod h1:oAkZiHX25cmr2Yun5V0q6CpnUemegvSrpcEy/oQcjzU=
github.com/IBM-Cloud/softlayer-go v1.0.5-tf h1:koUAyF9b6X78lLLruGYPSOmrfY2YcGYKOj/Ug9nbKNw=
github.com/IBM-Cloud/softlayer-go v1.0.5-tf/go.mod h1:6HepcfAXROz0Rf63krk5hPZyHT6qyx2MNvYyHof7ik4=
github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca h1:crniVcf+YcmgF03NmmfonXwSQ73oJF+IohFYBwknMxs=
Expand Down
7 changes: 6 additions & 1 deletion ibm/service/power/ibm_pi_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const (
Attr_IBMiPHA = "ibmi_pha"
Attr_IBMiRDS = "ibmi_rds"
Attr_IBMiRDSUsers = "ibmi_rds_users"
Attr_ICMPTypes = "icmp_types"
Attr_ICMPType = "icmp_type"
Attr_ID = "id"
Attr_ImageID = "image_id"
Attr_ImageInfo = "image_info"
Expand Down Expand Up @@ -452,7 +452,10 @@ const (
Deny = "deny"
DeploymentTypeEpic = "EPIC"
DeploymentTypeVMNoStorage = "VMNoStorage"
DestinationUnreach = "destination-unreach"
DHCPVlan = "dhcp-vlan"
Echo = "echo"
EchoReply = "echo-reply"
Hana = "Hana"
Hard = "hard"
Host = "host"
Expand All @@ -471,8 +474,10 @@ const (
SAP = "SAP"
Shared = "shared"
Soft = "soft"
SourceQuench = "source-quench"
Suffix = "suffix"
TCP = "tcp"
TimeExceeded = "time-exceeded"
UDP = "udp"
Vlan = "vlan"
vSCSI = "vSCSI"
Expand Down
25 changes: 12 additions & 13 deletions ibm/service/power/resource_ibm_pi_network_security_group_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ func ResourceIBMPINetworkSecurityGroupRule() *schema.Resource {
Description: "The protocol of the network traffic.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Attr_ICMPTypes: {
Description: "If icmp type, the list of ICMP packet types (by numbers) affected by ICMP rules and if not present then all types are matched.",
Elem: &schema.Schema{Type: schema.TypeInt},
Required: true,
Type: schema.TypeList,
Attr_ICMPType: {
Description: "If icmp type, a ICMP packet type affected by ICMP rules and if not present then all types are matched.",
Optional: true,
Type: schema.TypeString,
ValidateFunc: validate.ValidateAllowedStringValues([]string{All, DestinationUnreach, Echo, EchoReply, SourceQuench, TimeExceeded}),
},
Attr_TCPFlags: {
Description: "If tcp type, the list of TCP flags and if not present then all flags are matched.",
Expand Down Expand Up @@ -253,11 +253,10 @@ func ResourceIBMPINetworkSecurityGroupRule() *schema.Resource {
Description: "The list of protocol.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Attr_ICMPTypes: {
Attr_ICMPType: {
Computed: true,
Description: "If icmp type, the list of ICMP packet types (by numbers) affected by ICMP rules and if not present then all types are matched.",
Elem: &schema.Schema{Type: schema.TypeFloat},
Type: schema.TypeList,
Description: "If icmp type, a ICMP packet type affected by ICMP rules and if not present then all types are matched.",
Type: schema.TypeString,
},
Attr_TCPFlags: {
Computed: true,
Expand Down Expand Up @@ -575,8 +574,8 @@ func networkSecurityGroupRulePortToMap(port *models.NetworkSecurityGroupRulePort

func networkSecurityGroupRuleProtocolToMap(protocol *models.NetworkSecurityGroupRuleProtocol) map[string]interface{} {
protocolMap := make(map[string]interface{})
if protocol.IcmpTypes != nil {
protocolMap[Attr_ICMPTypes] = protocol.IcmpTypes
if protocol.IcmpType != nil {
protocolMap[Attr_ICMPType] = protocol.IcmpType
}
if len(protocol.TCPFlags) > 0 {
tcpFlags := []map[string]interface{}{}
Expand Down Expand Up @@ -629,8 +628,8 @@ func networkSecurityGroupRuleMapToProtocol(protocolMap map[string]interface{}) *
networkSecurityGroupRuleProtocol.Type = protocolMap[Attr_Type].(string)

if networkSecurityGroupRuleProtocol.Type == ICMP {
icmpTypes := flex.ExpandInt64List(protocolMap[Attr_ICMPTypes].([]interface{}))
networkSecurityGroupRuleProtocol.IcmpTypes = icmpTypes
icmpType := protocolMap[Attr_ICMPType].(string)
networkSecurityGroupRuleProtocol.IcmpType = &icmpType
} else if networkSecurityGroupRuleProtocol.Type == TCP {
tcpMaps := protocolMap[Attr_TCPFlags].([]interface{})
networkSecurityGroupRuleProtocolTCPFlagArray := []*models.NetworkSecurityGroupRuleProtocolTCPFlag{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func testAccCheckIBMPINetworkSecurityGroupRuleConfigAddRule() string {
pi_network_security_group_id = "%[2]s"
pi_action = "allow"
pi_protocol {
icmp_types = []
type = "all"
}
pi_remote {
Expand All @@ -98,7 +97,6 @@ func testAccCheckIBMPINetworkSecurityGroupRuleConfigAddRuleTCP() string {
maximum = 19500
}
pi_protocol {
icmp_types = []
tcp_flags {
flag = "ack"
}
Expand Down

0 comments on commit c080474

Please sign in to comment.