gcloud alpha access-context-manager levels replace-all

NAME
gcloud alpha access-context-manager levels replace-all - replace all existing access levels
SYNOPSIS
gcloud alpha access-context-manager levels replace-all[POLICY]--source-file=SOURCE_FILE[--etag=ETAG][GCLOUD_WIDE_FLAG]
DESCRIPTION
(ALPHA) Replace all existing access level in specified accesspolicy with access levels specified in a file.
EXAMPLES
To replace all levels within a policy, using etag:
gcloudalphaaccess-context-managerlevelsreplace-allmy-policy-number--source-file=path-to-file-containing-all-replacement-access-levels.yaml--etag=optional-latest-etag-of-policy

To replace all levels within a policy, without using etag:

gcloudalphaaccess-context-managerlevelsreplace-allmy-policy-number--source-file=path-to-file-containing-all-replacement-access-levels.yaml
POSITIONAL ARGUMENTS
Policy resource - The access policy that contains the levels you want toreplace. This represents a Cloud resource.
[POLICY]
ID of the policy or fully qualified identifier for the policy.

To set thepolicy attribute:

  • provide the argumentpolicy on the command line;
  • set the propertyaccess_context_manager/policy;
  • automatically, if the current account belongs to an organization with exactlyone access policy..
REQUIRED FLAGS
--source-file=SOURCE_FILE
Path to a file containing a list of access levels.

An access level file is a YAML-formatted list of access levels, which are YAMLobjects representing a Basic or Custom level as described in the API reference.For example:

-name:accessPolicies/my_policy/accessLevels/my_leveltitle:MyBasicLeveldescription:Basiclevelforfoo.basic:combiningFunction:ANDconditions:-ipSubnetworks:-192.168.100.14/24-2001:db8::/48-members-user1:user1@example.com-name:accessPolicies/my_policy/accessLevels/my_other_leveltitle:MyOtherCustomLeveldescription:Customlevelforbar.custom:expr:expression:"origin.region_code in ['US', 'CA']"

For more information about the alpha version, see:https://cloud.google.com/access-context-manager/docs/reference/rest/v1alpha/accessPolicies.accessLevelsFor other versions, see:https://cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies.accessLevels

OPTIONAL FLAGS
--etag=ETAG
An etag which specifies the version of the Access Policy. Only etags thatrepresent the latest version of the Access Policy will be accepted.
GCLOUD WIDE FLAGS
These flags are available to all commands:--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.

Run$gcloud help for details.

API REFERENCE
This command uses theaccesscontextmanager/v1alpha API. The fulldocumentation for this API can be found at:https://cloud.google.com/access-context-manager/docs/reference/rest/
NOTES
This command is currently in alpha and might change without notice. If thiscommand fails with API permission errors despite specifying the correct project,you might be trying to access an API with an invitation-only early accessallowlist. These variants are also available:
gcloudaccess-context-managerlevelsreplace-all
gcloudbetaaccess-context-managerlevelsreplace-all

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-01-21 UTC.