Listas todos los firewallPolicyRuleCollectionGroups en un recurso FirewallPolicy.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups?api-version=2023-09-01
Parámetros de identificador URI
Nombre |
En |
Requerido |
Tipo |
Description |
firewallPolicyName
|
path |
True
|
string
|
Nombre de la directiva de firewall.
|
resourceGroupName
|
path |
True
|
string
|
Nombre del grupo de recursos.
|
subscriptionId
|
path |
True
|
string
|
Las credenciales de suscripción que identifican de forma exclusiva la suscripción a Microsoft Azure. El identificador de suscripción forma parte del URI para cada llamada al servicio.
|
api-version
|
query |
True
|
string
|
Versión de API del cliente.
|
Respuestas
Seguridad
azure_auth
Flujo de OAuth2 de Azure Active Directory.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Nombre |
Description |
user_impersonation
|
suplantación de su cuenta de usuario
|
Ejemplos
List all FirewallPolicyRuleCollectionGroup With Web Categories
Sample Request
GET https://management.azure.com/subscriptions/e747cc13-97d4-4a79-b463-42d7f4e558f2/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups?api-version=2023-09-01
/**
* Samples for FirewallPolicyRuleCollectionGroups List.
*/
public final class Main {
/*
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/
* FirewallPolicyRuleCollectionGroupWithWebCategoriesList.json
*/
/**
* Sample code: List all FirewallPolicyRuleCollectionGroup With Web Categories.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void listAllFirewallPolicyRuleCollectionGroupWithWebCategories(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.networks().manager().serviceClient().getFirewallPolicyRuleCollectionGroups().list("rg1", "firewallPolicy",
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-network
# USAGE
python firewall_policy_rule_collection_group_with_web_categories_list.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = NetworkManagementClient(
credential=DefaultAzureCredential(),
subscription_id="e747cc13-97d4-4a79-b463-42d7f4e558f2",
)
response = client.firewall_policy_rule_collection_groups.list(
resource_group_name="rg1",
firewall_policy_name="firewallPolicy",
)
for item in response:
print(item)
# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupWithWebCategoriesList.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armnetwork_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupWithWebCategoriesList.json
func ExampleFirewallPolicyRuleCollectionGroupsClient_NewListPager_listAllFirewallPolicyRuleCollectionGroupWithWebCategories() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armnetwork.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewFirewallPolicyRuleCollectionGroupsClient().NewListPager("rg1", "firewallPolicy", nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.FirewallPolicyRuleCollectionGroupListResult = armnetwork.FirewallPolicyRuleCollectionGroupListResult{
// Value: []*armnetwork.FirewallPolicyRuleCollectionGroup{
// {
// ID: to.Ptr("/subscriptions/e747cc13-97d4-4a79-b463-42d7f4e558f2/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"),
// Name: to.Ptr("ruleCollectionGroup1"),
// Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""),
// Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{
// Priority: to.Ptr[int32](110),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{
// &armnetwork.FirewallPolicyFilterRuleCollection{
// Name: to.Ptr("Example-Filter-Rule-Collection"),
// Priority: to.Ptr[int32](120),
// RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection),
// Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{
// Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny),
// },
// Rules: []armnetwork.FirewallPolicyRuleClassification{
// &armnetwork.ApplicationRule{
// Name: to.Ptr("rule1"),
// Description: to.Ptr("Deny inbound rule"),
// RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeApplicationRule),
// Protocols: []*armnetwork.FirewallPolicyRuleApplicationProtocol{
// {
// Port: to.Ptr[int32](443),
// ProtocolType: to.Ptr(armnetwork.FirewallPolicyRuleApplicationProtocolTypeHTTPS),
// }},
// SourceAddresses: []*string{
// to.Ptr("216.58.216.164"),
// to.Ptr("10.0.0.0/24")},
// WebCategories: []*string{
// to.Ptr("Hacking")},
// }},
// }},
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { NetworkManagementClient } = require("@azure/arm-network");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Lists all FirewallPolicyRuleCollectionGroups in a FirewallPolicy resource.
*
* @summary Lists all FirewallPolicyRuleCollectionGroups in a FirewallPolicy resource.
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupWithWebCategoriesList.json
*/
async function listAllFirewallPolicyRuleCollectionGroupWithWebCategories() {
const subscriptionId =
process.env["NETWORK_SUBSCRIPTION_ID"] || "e747cc13-97d4-4a79-b463-42d7f4e558f2";
const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1";
const firewallPolicyName = "firewallPolicy";
const credential = new DefaultAzureCredential();
const client = new NetworkManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.firewallPolicyRuleCollectionGroups.list(
resourceGroupName,
firewallPolicyName,
)) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Network;
using Azure.ResourceManager.Network.Models;
// Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupWithWebCategoriesList.json
// this example is just showing the usage of "FirewallPolicyRuleCollectionGroups_List" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this FirewallPolicyResource created on azure
// for more information of creating FirewallPolicyResource, please refer to the document of FirewallPolicyResource
string subscriptionId = "e747cc13-97d4-4a79-b463-42d7f4e558f2";
string resourceGroupName = "rg1";
string firewallPolicyName = "firewallPolicy";
ResourceIdentifier firewallPolicyResourceId = FirewallPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, firewallPolicyName);
FirewallPolicyResource firewallPolicy = client.GetFirewallPolicyResource(firewallPolicyResourceId);
// get the collection of this FirewallPolicyRuleCollectionGroupResource
FirewallPolicyRuleCollectionGroupCollection collection = firewallPolicy.GetFirewallPolicyRuleCollectionGroups();
// invoke the operation and iterate over the result
await foreach (FirewallPolicyRuleCollectionGroupResource item in collection.GetAllAsync())
{
// the variable item is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
FirewallPolicyRuleCollectionGroupData resourceData = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"value": [
{
"name": "ruleCollectionGroup1",
"id": "/subscriptions/e747cc13-97d4-4a79-b463-42d7f4e558f2/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1",
"etag": "W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\"",
"properties": {
"provisioningState": "Succeeded",
"priority": 110,
"ruleCollections": [
{
"name": "Example-Filter-Rule-Collection",
"ruleCollectionType": "FirewallPolicyFilterRuleCollection",
"priority": 120,
"action": {
"type": "Deny"
},
"rules": [
{
"ruleType": "ApplicationRule",
"name": "rule1",
"description": "Deny inbound rule",
"protocols": [
{
"protocolType": "Https",
"port": 443
}
],
"sourceAddresses": [
"216.58.216.164",
"10.0.0.0/24"
],
"webCategories": [
"Hacking"
]
}
]
}
]
}
}
]
}
List all FirewallPolicyRuleCollectionGroups for a given FirewallPolicy
Sample Request
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups?api-version=2023-09-01
/**
* Samples for FirewallPolicyRuleCollectionGroups List.
*/
public final class Main {
/*
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/
* FirewallPolicyRuleCollectionGroupList.json
*/
/**
* Sample code: List all FirewallPolicyRuleCollectionGroups for a given FirewallPolicy.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void listAllFirewallPolicyRuleCollectionGroupsForAGivenFirewallPolicy(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.networks().manager().serviceClient().getFirewallPolicyRuleCollectionGroups().list("rg1", "firewallPolicy",
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-network
# USAGE
python firewall_policy_rule_collection_group_list.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = NetworkManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.firewall_policy_rule_collection_groups.list(
resource_group_name="rg1",
firewall_policy_name="firewallPolicy",
)
for item in response:
print(item)
# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupList.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armnetwork_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupList.json
func ExampleFirewallPolicyRuleCollectionGroupsClient_NewListPager_listAllFirewallPolicyRuleCollectionGroupsForAGivenFirewallPolicy() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armnetwork.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewFirewallPolicyRuleCollectionGroupsClient().NewListPager("rg1", "firewallPolicy", nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.FirewallPolicyRuleCollectionGroupListResult = armnetwork.FirewallPolicyRuleCollectionGroupListResult{
// Value: []*armnetwork.FirewallPolicyRuleCollectionGroup{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"),
// Name: to.Ptr("ruleCollectionGroup1"),
// Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""),
// Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{
// Priority: to.Ptr[int32](110),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{
// &armnetwork.FirewallPolicyFilterRuleCollection{
// Name: to.Ptr("Example-Filter-Rule-Collection"),
// Priority: to.Ptr[int32](120),
// RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection),
// Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{
// Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny),
// },
// Rules: []armnetwork.FirewallPolicyRuleClassification{
// &armnetwork.Rule{
// Name: to.Ptr("network-rule-1"),
// Description: to.Ptr("Network rule"),
// RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeNetworkRule),
// DestinationAddresses: []*string{
// to.Ptr("*")},
// DestinationPorts: []*string{
// to.Ptr("*")},
// IPProtocols: []*armnetwork.FirewallPolicyRuleNetworkProtocol{
// to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolTCP)},
// SourceAddresses: []*string{
// to.Ptr("10.1.25.0/24")},
// }},
// }},
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { NetworkManagementClient } = require("@azure/arm-network");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Lists all FirewallPolicyRuleCollectionGroups in a FirewallPolicy resource.
*
* @summary Lists all FirewallPolicyRuleCollectionGroups in a FirewallPolicy resource.
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupList.json
*/
async function listAllFirewallPolicyRuleCollectionGroupsForAGivenFirewallPolicy() {
const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1";
const firewallPolicyName = "firewallPolicy";
const credential = new DefaultAzureCredential();
const client = new NetworkManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.firewallPolicyRuleCollectionGroups.list(
resourceGroupName,
firewallPolicyName,
)) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Network;
using Azure.ResourceManager.Network.Models;
// Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupList.json
// this example is just showing the usage of "FirewallPolicyRuleCollectionGroups_List" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this FirewallPolicyResource created on azure
// for more information of creating FirewallPolicyResource, please refer to the document of FirewallPolicyResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
string firewallPolicyName = "firewallPolicy";
ResourceIdentifier firewallPolicyResourceId = FirewallPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, firewallPolicyName);
FirewallPolicyResource firewallPolicy = client.GetFirewallPolicyResource(firewallPolicyResourceId);
// get the collection of this FirewallPolicyRuleCollectionGroupResource
FirewallPolicyRuleCollectionGroupCollection collection = firewallPolicy.GetFirewallPolicyRuleCollectionGroups();
// invoke the operation and iterate over the result
await foreach (FirewallPolicyRuleCollectionGroupResource item in collection.GetAllAsync())
{
// the variable item is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
FirewallPolicyRuleCollectionGroupData resourceData = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"value": [
{
"name": "ruleCollectionGroup1",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1",
"etag": "W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\"",
"properties": {
"provisioningState": "Succeeded",
"priority": 110,
"ruleCollections": [
{
"name": "Example-Filter-Rule-Collection",
"ruleCollectionType": "FirewallPolicyFilterRuleCollection",
"priority": 120,
"action": {
"type": "Deny"
},
"rules": [
{
"name": "network-rule-1",
"ruleType": "NetworkRule",
"description": "Network rule",
"destinationAddresses": [
"*"
],
"sourceAddresses": [
"10.1.25.0/24"
],
"ipProtocols": [
"TCP"
],
"destinationPorts": [
"*"
]
}
]
}
]
}
}
]
}
List all FirewallPolicyRuleCollectionGroups with IpGroups for a given FirewallPolicy
Sample Request
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups?api-version=2023-09-01
/**
* Samples for FirewallPolicyRuleCollectionGroups List.
*/
public final class Main {
/*
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/
* FirewallPolicyRuleCollectionGroupWithIpGroupsList.json
*/
/**
* Sample code: List all FirewallPolicyRuleCollectionGroups with IpGroups for a given FirewallPolicy.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void listAllFirewallPolicyRuleCollectionGroupsWithIpGroupsForAGivenFirewallPolicy(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.networks().manager().serviceClient().getFirewallPolicyRuleCollectionGroups().list("rg1", "firewallPolicy",
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-network
# USAGE
python firewall_policy_rule_collection_group_with_ip_groups_list.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = NetworkManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.firewall_policy_rule_collection_groups.list(
resource_group_name="rg1",
firewall_policy_name="firewallPolicy",
)
for item in response:
print(item)
# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupWithIpGroupsList.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armnetwork_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupWithIpGroupsList.json
func ExampleFirewallPolicyRuleCollectionGroupsClient_NewListPager_listAllFirewallPolicyRuleCollectionGroupsWithIpGroupsForAGivenFirewallPolicy() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armnetwork.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewFirewallPolicyRuleCollectionGroupsClient().NewListPager("rg1", "firewallPolicy", nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.FirewallPolicyRuleCollectionGroupListResult = armnetwork.FirewallPolicyRuleCollectionGroupListResult{
// Value: []*armnetwork.FirewallPolicyRuleCollectionGroup{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1"),
// Name: to.Ptr("ruleCollectionGroup1"),
// Etag: to.Ptr("W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\""),
// Properties: &armnetwork.FirewallPolicyRuleCollectionGroupProperties{
// Priority: to.Ptr[int32](110),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// RuleCollections: []armnetwork.FirewallPolicyRuleCollectionClassification{
// &armnetwork.FirewallPolicyFilterRuleCollection{
// Name: to.Ptr("Example-Filter-Rule-Collection"),
// Priority: to.Ptr[int32](120),
// RuleCollectionType: to.Ptr(armnetwork.FirewallPolicyRuleCollectionTypeFirewallPolicyFilterRuleCollection),
// Action: &armnetwork.FirewallPolicyFilterRuleCollectionAction{
// Type: to.Ptr(armnetwork.FirewallPolicyFilterRuleCollectionActionTypeDeny),
// },
// Rules: []armnetwork.FirewallPolicyRuleClassification{
// &armnetwork.Rule{
// Name: to.Ptr("network-rule-1"),
// Description: to.Ptr("Network rule"),
// RuleType: to.Ptr(armnetwork.FirewallPolicyRuleTypeNetworkRule),
// DestinationIPGroups: []*string{
// to.Ptr("/subscriptions/subid/providers/Microsoft.Network/resourceGroup/rg1/ipGroups/ipGroups2")},
// DestinationPorts: []*string{
// to.Ptr("*")},
// IPProtocols: []*armnetwork.FirewallPolicyRuleNetworkProtocol{
// to.Ptr(armnetwork.FirewallPolicyRuleNetworkProtocolTCP)},
// SourceIPGroups: []*string{
// to.Ptr("/subscriptions/subid/providers/Microsoft.Network/resourceGroup/rg1/ipGroups/ipGroups1")},
// }},
// }},
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { NetworkManagementClient } = require("@azure/arm-network");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Lists all FirewallPolicyRuleCollectionGroups in a FirewallPolicy resource.
*
* @summary Lists all FirewallPolicyRuleCollectionGroups in a FirewallPolicy resource.
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupWithIpGroupsList.json
*/
async function listAllFirewallPolicyRuleCollectionGroupsWithIPGroupsForAGivenFirewallPolicy() {
const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1";
const firewallPolicyName = "firewallPolicy";
const credential = new DefaultAzureCredential();
const client = new NetworkManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.firewallPolicyRuleCollectionGroups.list(
resourceGroupName,
firewallPolicyName,
)) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Network;
using Azure.ResourceManager.Network.Models;
// Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/FirewallPolicyRuleCollectionGroupWithIpGroupsList.json
// this example is just showing the usage of "FirewallPolicyRuleCollectionGroups_List" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this FirewallPolicyResource created on azure
// for more information of creating FirewallPolicyResource, please refer to the document of FirewallPolicyResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
string firewallPolicyName = "firewallPolicy";
ResourceIdentifier firewallPolicyResourceId = FirewallPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, firewallPolicyName);
FirewallPolicyResource firewallPolicy = client.GetFirewallPolicyResource(firewallPolicyResourceId);
// get the collection of this FirewallPolicyRuleCollectionGroupResource
FirewallPolicyRuleCollectionGroupCollection collection = firewallPolicy.GetFirewallPolicyRuleCollectionGroups();
// invoke the operation and iterate over the result
await foreach (FirewallPolicyRuleCollectionGroupResource item in collection.GetAllAsync())
{
// the variable item is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
FirewallPolicyRuleCollectionGroupData resourceData = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"value": [
{
"name": "ruleCollectionGroup1",
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/ruleCollectionGroups/ruleCollectionGroup1",
"etag": "W/\"72090554-7e3b-43f2-80ad-99a9020dcb11\"",
"properties": {
"provisioningState": "Succeeded",
"priority": 110,
"ruleCollections": [
{
"name": "Example-Filter-Rule-Collection",
"ruleCollectionType": "FirewallPolicyFilterRuleCollection",
"priority": 120,
"action": {
"type": "Deny"
},
"rules": [
{
"name": "network-rule-1",
"ruleType": "NetworkRule",
"description": "Network rule",
"sourceIpGroups": [
"/subscriptions/subid/providers/Microsoft.Network/resourceGroup/rg1/ipGroups/ipGroups1"
],
"destinationIpGroups": [
"/subscriptions/subid/providers/Microsoft.Network/resourceGroup/rg1/ipGroups/ipGroups2"
],
"ipProtocols": [
"TCP"
],
"destinationPorts": [
"*"
]
}
]
}
]
}
}
]
}
Definiciones
ApplicationRule
Regla de tipo aplicación.
Nombre |
Tipo |
Description |
description
|
string
|
Descripción de la regla.
|
destinationAddresses
|
string[]
|
Lista de direcciones IP de destino o etiquetas de servicio.
|
fqdnTags
|
string[]
|
Lista de etiquetas FQDN para esta regla.
|
httpHeadersToInsert
|
FirewallPolicyHttpHeaderToInsert[]
|
Lista de encabezados HTTP/S que se van a insertar.
|
name
|
string
|
Nombre de la regla.
|
protocols
|
FirewallPolicyRuleApplicationProtocol[]
|
Matriz de protocolos de aplicación.
|
ruleType
|
string:
ApplicationRule
|
Tipo de regla.
|
sourceAddresses
|
string[]
|
Lista de direcciones IP de origen para esta regla.
|
sourceIpGroups
|
string[]
|
Lista de ipGroups de origen para esta regla.
|
targetFqdns
|
string[]
|
Lista de FQDN para esta regla.
|
targetUrls
|
string[]
|
Lista de direcciones URL para esta condición de regla.
|
terminateTLS
|
boolean
|
Finalice las conexiones TLS para esta regla.
|
webCategories
|
string[]
|
Lista de categorías web de Azure de destino.
|
CloudError
Respuesta de error del servicio.
Nombre |
Tipo |
Description |
error
|
CloudErrorBody
|
Cuerpo del error en la nube.
|
CloudErrorBody
Respuesta de error del servicio.
Nombre |
Tipo |
Description |
code
|
string
|
Identificador del error. Los códigos son invariables y están diseñados para consumirse mediante programación.
|
details
|
CloudErrorBody[]
|
Lista de detalles adicionales sobre el error.
|
message
|
string
|
Mensaje que describe el error, diseñado para ser adecuado para mostrarse en una interfaz de usuario.
|
target
|
string
|
Destino del error concreto. Por ejemplo, el nombre de la propiedad en error.
|
FirewallPolicyFilterRuleCollection
Colección de reglas de filtro de directiva de firewall.
Nombre |
Tipo |
Description |
action
|
FirewallPolicyFilterRuleCollectionAction
|
Tipo de acción de una colección de reglas de filtro.
|
name
|
string
|
Nombre de la colección de reglas.
|
priority
|
integer
|
Prioridad del recurso colección de reglas de directiva de firewall.
|
ruleCollectionType
|
string:
FirewallPolicyFilterRuleCollection
|
Tipo de la colección de reglas.
|
rules
|
FirewallPolicyRule[]:
|
Lista de reglas incluidas en una colección de reglas.
|
FirewallPolicyFilterRuleCollectionAction
Propiedades de FirewallPolicyFilterRuleCollectionAction.
FirewallPolicyFilterRuleCollectionActionType
Tipo de acción de una regla.
Nombre |
Tipo |
Description |
Allow
|
string
|
|
Deny
|
string
|
|
nombre y valor del encabezado HTTP/S que se va a insertar
Nombre |
Tipo |
Description |
headerName
|
string
|
Contiene el nombre del encabezado.
|
headerValue
|
string
|
Contiene el valor del encabezado.
|
FirewallPolicyNatRuleCollection
Colección de reglas NAT de directiva de firewall.
Nombre |
Tipo |
Description |
action
|
FirewallPolicyNatRuleCollectionAction
|
Tipo de acción de una colección de reglas Nat.
|
name
|
string
|
Nombre de la colección de reglas.
|
priority
|
integer
|
Prioridad del recurso colección de reglas de directiva de firewall.
|
ruleCollectionType
|
string:
FirewallPolicyNatRuleCollection
|
Tipo de la colección de reglas.
|
rules
|
FirewallPolicyRule[]:
|
Lista de reglas incluidas en una colección de reglas.
|
FirewallPolicyNatRuleCollectionAction
Propiedades de FirewallPolicyNatRuleCollectionAction.
FirewallPolicyNatRuleCollectionActionType
Tipo de acción de una regla.
Nombre |
Tipo |
Description |
DNAT
|
string
|
|
FirewallPolicyRuleApplicationProtocol
Propiedades del protocolo de regla de aplicación.
FirewallPolicyRuleApplicationProtocolType
Tipo de protocolo de aplicación de una regla.
Nombre |
Tipo |
Description |
Http
|
string
|
|
Https
|
string
|
|
FirewallPolicyRuleCollectionGroup
Recurso grupo de recopilación de reglas.
Nombre |
Tipo |
Description |
etag
|
string
|
Cadena de solo lectura única que cambia cada vez que se actualiza el recurso.
|
id
|
string
|
Identificador del recurso.
|
name
|
string
|
Nombre del recurso que es único dentro de un grupo de recursos. Este nombre se puede usar para acceder al recurso.
|
properties.priority
|
integer
|
Prioridad del recurso grupo de recopilación de reglas de directiva de firewall.
|
properties.provisioningState
|
ProvisioningState
|
Estado de aprovisionamiento del recurso del grupo de recopilación de reglas de directiva de firewall.
|
properties.ruleCollections
|
FirewallPolicyRuleCollection[]:
|
Grupo de recopilaciones de reglas de directiva de firewall.
|
properties.size
|
string
|
Cadena de solo lectura que representa el tamaño de FirewallPolicyRuleCollectionGroupProperties en MB. (por ejemplo, 1,2 MB)
|
type
|
string
|
Tipo de grupo de reglas.
|
FirewallPolicyRuleCollectionGroupListResult
Respuesta para la llamada al servicio api ListFirewallPolicyRuleCollectionGroups.
Nombre |
Tipo |
Description |
nextLink
|
string
|
Dirección URL para obtener el siguiente conjunto de resultados.
|
value
|
FirewallPolicyRuleCollectionGroup[]
|
Lista de FirewallPolicyRuleCollectionGroups en firewallPolicy.
|
FirewallPolicyRuleNetworkProtocol
Protocolo de red de una regla.
Nombre |
Tipo |
Description |
Any
|
string
|
|
ICMP
|
string
|
|
TCP
|
string
|
|
UDP
|
string
|
|
NatRule
Regla de tipo nat.
Nombre |
Tipo |
Description |
description
|
string
|
Descripción de la regla.
|
destinationAddresses
|
string[]
|
Lista de direcciones IP de destino o etiquetas de servicio.
|
destinationPorts
|
string[]
|
Lista de puertos de destino.
|
ipProtocols
|
FirewallPolicyRuleNetworkProtocol[]
|
Matriz de FirewallPolicyRuleNetworkProtocols.
|
name
|
string
|
Nombre de la regla.
|
ruleType
|
string:
NatRule
|
Tipo de regla.
|
sourceAddresses
|
string[]
|
Lista de direcciones IP de origen para esta regla.
|
sourceIpGroups
|
string[]
|
Lista de ipGroups de origen para esta regla.
|
translatedAddress
|
string
|
Dirección traducida de esta regla NAT.
|
translatedFqdn
|
string
|
FQDN traducido para esta regla NAT.
|
translatedPort
|
string
|
Puerto traducido para esta regla NAT.
|
NetworkRule
Regla de tipo red.
Nombre |
Tipo |
Description |
description
|
string
|
Descripción de la regla.
|
destinationAddresses
|
string[]
|
Lista de direcciones IP de destino o etiquetas de servicio.
|
destinationFqdns
|
string[]
|
Lista de FQDN de destino.
|
destinationIpGroups
|
string[]
|
Lista de ipGroups de destino para esta regla.
|
destinationPorts
|
string[]
|
Lista de puertos de destino.
|
ipProtocols
|
FirewallPolicyRuleNetworkProtocol[]
|
Matriz de FirewallPolicyRuleNetworkProtocols.
|
name
|
string
|
Nombre de la regla.
|
ruleType
|
string:
NetworkRule
|
Tipo de regla.
|
sourceAddresses
|
string[]
|
Lista de direcciones IP de origen para esta regla.
|
sourceIpGroups
|
string[]
|
Lista de ipGroups de origen para esta regla.
|
ProvisioningState
Estado de aprovisionamiento actual.
Nombre |
Tipo |
Description |
Deleting
|
string
|
|
Failed
|
string
|
|
Succeeded
|
string
|
|
Updating
|
string
|
|