# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).

import oci

# Create a default config using DEFAULT profile in default location
# Refer to
# https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File
# for more info
config = oci.config.from_file()


# Initialize service client with default config file
core_client = oci.core.VirtualNetworkClient(config)


# Send the request to service, some parameters are not required, see API
# doc for more info
update_network_security_group_security_rules_response = core_client.update_network_security_group_security_rules(
    network_security_group_id="ocid1.test.oc1..<unique_ID>EXAMPLE-networkSecurityGroupId-Value",
    update_network_security_group_security_rules_details=oci.core.models.UpdateNetworkSecurityGroupSecurityRulesDetails(
        security_rules=[
            oci.core.models.UpdateSecurityRuleDetails(
                direction="EGRESS",
                id="ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
                protocol="EXAMPLE-protocol-Value",
                description="EXAMPLE-description-Value",
                destination="EXAMPLE-destination-Value",
                destination_type="CIDR_BLOCK",
                icmp_options=oci.core.models.IcmpOptions(
                    type=737,
                    code=731),
                is_stateless=True,
                source="EXAMPLE-source-Value",
                source_type="CIDR_BLOCK",
                tcp_options=oci.core.models.TcpOptions(
                    destination_port_range=oci.core.models.PortRange(
                            max=205,
                            min=947),
                    source_port_range=oci.core.models.PortRange(
                        max=757,
                        min=27)),
                udp_options=oci.core.models.UdpOptions(
                    destination_port_range=oci.core.models.PortRange(
                        max=273,
                        min=639),
                    source_port_range=oci.core.models.PortRange(
                        max=727,
                        min=78)))]))

# Get the data from response
print(update_network_security_group_security_rules_response.data)