CINXE.COM

Enable and use object retention configurations  |  Cloud Storage  |  Google Cloud

<!doctype html> <html lang="en" dir="ltr"> <head> <meta name="google-signin-client-id" content="721724668570-nbkv1cfusk7kk4eni4pjvepaus73b13t.apps.googleusercontent.com"> <meta name="google-signin-scope" content="profile email https://www.googleapis.com/auth/developerprofiles https://www.googleapis.com/auth/developerprofiles.award https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/webhistory"> <meta property="og:site_name" content="Google Cloud"> <meta property="og:type" content="website"><meta name="theme-color" content="#039be5"><meta charset="utf-8"> <meta content="IE=Edge" http-equiv="X-UA-Compatible"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="manifest" href="/_pwa/cloud/manifest.json" crossorigin="use-credentials"> <link rel="preconnect" href="//www.gstatic.com" crossorigin> <link rel="preconnect" href="//fonts.gstatic.com" crossorigin> <link rel="preconnect" href="//fonts.googleapis.com" crossorigin> <link rel="preconnect" href="//apis.google.com" crossorigin> <link rel="preconnect" href="//www.google-analytics.com" crossorigin><link rel="stylesheet" href="//fonts.googleapis.com/css?family=Google+Sans:400,500,700|Google+Sans+Text:400,400italic,500,500italic,700,700italic|Roboto:400,400italic,500,500italic,700,700italic|Roboto+Mono:400,500,700&display=swap"> <link rel="stylesheet" href="//fonts.googleapis.com/css2?family=Material+Icons&family=Material+Symbols+Outlined&display=block"><link rel="stylesheet" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/css/app.css"> <link rel="shortcut icon" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/favicon.ico"> <link rel="apple-touch-icon" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/super_cloud.png"><link rel="canonical" href="https://cloud.google.com/storage/docs/using-object-lock"><link rel="search" type="application/opensearchdescription+xml" title="Google Cloud" href="https://cloud.google.com/s/opensearch.xml"> <link rel="alternate" hreflang="en" href="https://cloud.google.com/storage/docs/using-object-lock" /><link rel="alternate" hreflang="x-default" href="https://cloud.google.com/storage/docs/using-object-lock" /><link rel="alternate" hreflang="zh-Hans" href="https://cloud.google.com/storage/docs/using-object-lock?hl=zh-cn" /><link rel="alternate" hreflang="fr" href="https://cloud.google.com/storage/docs/using-object-lock?hl=fr" /><link rel="alternate" hreflang="de" href="https://cloud.google.com/storage/docs/using-object-lock?hl=de" /><link rel="alternate" hreflang="id" href="https://cloud.google.com/storage/docs/using-object-lock?hl=id" /><link rel="alternate" hreflang="it" href="https://cloud.google.com/storage/docs/using-object-lock?hl=it" /><link rel="alternate" hreflang="ja" href="https://cloud.google.com/storage/docs/using-object-lock?hl=ja" /><link rel="alternate" hreflang="ko" href="https://cloud.google.com/storage/docs/using-object-lock?hl=ko" /><link rel="alternate" hreflang="pt-BR" href="https://cloud.google.com/storage/docs/using-object-lock?hl=pt-br" /><link rel="alternate" hreflang="es-419" href="https://cloud.google.com/storage/docs/using-object-lock?hl=es-419" /><title>Enable and use object retention configurations &nbsp;|&nbsp; Cloud Storage &nbsp;|&nbsp; Google Cloud</title> <meta property="og:title" content="Enable and use object retention configurations &nbsp;|&nbsp; Cloud Storage &nbsp;|&nbsp; Google Cloud"><meta property="og:url" content="https://cloud.google.com/storage/docs/using-object-lock"><meta property="og:image" content="https://cloud.google.com/_static/cloud/images/social-icon-google-cloud-1200-630.png"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="630"><meta property="og:locale" content="en"><meta name="twitter:card" content="summary_large_image"><script type="application/ld+json"> { "@context": "https://schema.org", "@type": "Article", "headline": "Enable and use object retention configurations" } </script><script type="application/ld+json"> { "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{ "@type": "ListItem", "position": 1, "name": "Cloud Storage", "item": "https://cloud.google.com/storage" },{ "@type": "ListItem", "position": 2, "name": "Documentation", "item": "https://cloud.google.com/storage/docs" },{ "@type": "ListItem", "position": 3, "name": "Enable and use object retention configurations", "item": "https://cloud.google.com/storage/docs/using-object-lock" }] } </script> <link rel="stylesheet" href="/extras.css"></head> <body class="" template="page" theme="cloud-theme" type="article" layout="docs" free-trial display-toc pending> <devsite-progress type="indeterminate" id="app-progress"></devsite-progress> <section class="devsite-wrapper"> <devsite-cookie-notification-bar></devsite-cookie-notification-bar><cloudx-track userCountry="SG"></cloudx-track> <cloudx-utils-init></cloudx-utils-init> <devsite-header keep-tabs-visible> <div class="devsite-header--inner nocontent"> <div class="devsite-top-logo-row-wrapper-wrapper"> <div class="devsite-top-logo-row-wrapper"> <div class="devsite-top-logo-row"> <button type="button" id="devsite-hamburger-menu" class="devsite-header-icon-button button-flat material-icons gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Navigation menu button" visually-hidden aria-label="Open menu"> </button> <div class="devsite-product-name-wrapper"> <a href="/" class="devsite-site-logo-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Site logo" track-type="globalNav" track-name="googleCloud" track-metadata-position="nav" track-metadata-eventDetail="nav"> <picture> <img src="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/cloud-logo.svg" class="devsite-site-logo" alt="Google Cloud"> </picture> </a> <span class="devsite-product-name"> <ul class="devsite-breadcrumb-list" > <li class="devsite-breadcrumb-item devsite-has-google-wordmark"> </li> </ul> </span> </div> <div class="devsite-top-logo-row-middle"> <div class="devsite-header-upper-tabs"> <cloudx-tabs-nav class="upper-tabs"> <nav class="devsite-tabs-wrapper" aria-label="Upper tabs"> <tab class="devsite-active"> <a href="https://cloud.google.com/docs" track-metadata-eventdetail="https://cloud.google.com/docs" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - docs-home" track-metadata-module="primary nav" aria-label="Documentation, selected" data-category="Site-Wide Custom Events" data-label="Tab: Documentation" track-name="docs-home" track-link-column-type="single-column" > Documentation </a> </tab> <tab class="devsite-dropdown devsite-clickable "> <a href="https://cloud.google.com/docs/tech-area-overviews" track-metadata-eventdetail="https://cloud.google.com/docs/tech-area-overviews" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - technology-areas" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Technology areas" track-name="technology-areas" track-link-column-type="single-column" > Technology areas </a> <a href="#" role="button" aria-haspopup="true" aria-expanded="false" aria-label="Dropdown menu for Technology areas" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/tech-area-overviews" track-metadata-position="nav - technology-areas" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Technology areas" track-name="technology-areas" track-link-column-type="single-column" class="devsite-tabs-dropdown-toggle devsite-icon devsite-icon-arrow-drop-down"></a> <div class="devsite-tabs-dropdown" aria-label="submenu" hidden> <button class="devsite-tabs-close-button material-icons button-flat gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Close dropdown menu" aria-label="Close dropdown menu" track-type="nav" track-name="close" track-metadata-eventdetail="#" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav">close</button> <div class="devsite-tabs-dropdown-content"> <div class="devsite-tabs-dropdown-column "> <ul class="devsite-tabs-dropdown-section "> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/ai-ml" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/ai-ml" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> AI and ML </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/application-development" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/application-development" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Application development </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/application-hosting" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/application-hosting" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Application hosting </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/compute-area" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/compute-area" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Compute </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/data" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/data" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Data analytics and pipelines </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/databases" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/databases" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Databases </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/dhm-cloud" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/dhm-cloud" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Distributed, hybrid, and multicloud </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/generative-ai" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/generative-ai" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Generative AI </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/industry" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/industry" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Industry solutions </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/networking" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/networking" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Networking </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/observability" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/observability" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Observability and monitoring </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/security" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/security" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Security </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/storage" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/storage" track-metadata-position="nav - technology-areas" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Storage </div> </a> </li> </ul> </div> </div> </div> </tab> <tab class="devsite-dropdown devsite-clickable "> <a href="https://cloud.google.com/docs/cross-product-overviews" track-metadata-eventdetail="https://cloud.google.com/docs/cross-product-overviews" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - crossproduct" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Cross-product tools" track-name="crossproduct" track-link-column-type="single-column" > Cross-product tools </a> <a href="#" role="button" aria-haspopup="true" aria-expanded="false" aria-label="Dropdown menu for Cross-product tools" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/cross-product-overviews" track-metadata-position="nav - crossproduct" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Cross-product tools" track-name="crossproduct" track-link-column-type="single-column" class="devsite-tabs-dropdown-toggle devsite-icon devsite-icon-arrow-drop-down"></a> <div class="devsite-tabs-dropdown" aria-label="submenu" hidden> <button class="devsite-tabs-close-button material-icons button-flat gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Close dropdown menu" aria-label="Close dropdown menu" track-type="nav" track-name="close" track-metadata-eventdetail="#" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav">close</button> <div class="devsite-tabs-dropdown-content"> <div class="devsite-tabs-dropdown-column "> <ul class="devsite-tabs-dropdown-section "> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/access-resources" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/access-resources" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Access and resources management </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/costs-usage" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/costs-usage" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Costs and usage management </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/devtools" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/devtools" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud SDK, languages, frameworks, and tools </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/iac" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/iac" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Infrastructure as code </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/docs/migration" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/docs/migration" track-metadata-position="nav - crossproduct" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Migration </div> </a> </li> </ul> </div> </div> </div> </tab> <tab class="devsite-dropdown devsite-clickable "> <a href="https://cloud.google.com/" track-metadata-eventdetail="https://cloud.google.com/" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - related-sites" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Related sites" track-name="related-sites" track-link-column-type="single-column" > Related sites </a> <a href="#" role="button" aria-haspopup="true" aria-expanded="false" aria-label="Dropdown menu for Related sites" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/" track-metadata-position="nav - related-sites" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Related sites" track-name="related-sites" track-link-column-type="single-column" class="devsite-tabs-dropdown-toggle devsite-icon devsite-icon-arrow-drop-down"></a> <div class="devsite-tabs-dropdown" aria-label="submenu" hidden> <button class="devsite-tabs-close-button material-icons button-flat gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Close dropdown menu" aria-label="Close dropdown menu" track-type="nav" track-name="close" track-metadata-eventdetail="#" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav">close</button> <div class="devsite-tabs-dropdown-content"> <div class="devsite-tabs-dropdown-column "> <ul class="devsite-tabs-dropdown-section "> <li class="devsite-nav-item"> <a href="https://cloud.google.com/" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Home </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/free" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/free" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Free Trial and Free Tier </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/architecture" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/architecture" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Architecture Center </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/blog" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/blog" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Blog </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/contact" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/contact" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Contact Sales </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/developers" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/developers" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Developer Center </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.google.com/" track-type="nav" track-metadata-eventdetail="https://developers.google.com/" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Developer Center </div> </a> </li> <li class="devsite-nav-item"> <a href="https://console.cloud.google.com/marketplace" track-type="nav" track-metadata-eventdetail="https://console.cloud.google.com/marketplace" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Marketplace </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/marketplace/docs" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/marketplace/docs" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Marketplace Documentation </div> </a> </li> <li class="devsite-nav-item"> <a href="https://www.cloudskillsboost.google/paths" track-type="nav" track-metadata-eventdetail="https://www.cloudskillsboost.google/paths" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Skills Boost </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/solutions" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/solutions" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Solution Center </div> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/support-hub" track-type="nav" track-metadata-eventdetail="https://cloud.google.com/support-hub" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Support </div> </a> </li> <li class="devsite-nav-item"> <a href="https://www.youtube.com/@googlecloudtech" track-type="nav" track-metadata-eventdetail="https://www.youtube.com/@googlecloudtech" track-metadata-position="nav - related-sites" track-metadata-module="tertiary nav" tooltip > <div class="devsite-nav-item-title"> Google Cloud Tech Youtube Channel </div> </a> </li> </ul> </div> </div> </div> </tab> </nav> </cloudx-tabs-nav> </div> <devsite-search enable-signin enable-search enable-suggestions project-name="Cloud Storage" tenant-name="Google Cloud" project-scope="/storage/docs" url-scoped="https://cloud.google.com/s/results/storage/docs" > <form class="devsite-search-form" action="https://cloud.google.com/s/results" method="GET"> <div class="devsite-search-container"> <button type="button" search-open class="devsite-search-button devsite-header-icon-button button-flat material-icons" aria-label="Open search"></button> <div class="devsite-searchbox"> <input aria-activedescendant="" aria-autocomplete="list" aria-label="Search" aria-expanded="false" aria-haspopup="listbox" autocomplete="off" class="devsite-search-field devsite-search-query" name="q" placeholder="Search" role="combobox" type="text" value="" > <div class="devsite-search-image material-icons" aria-hidden="true"> </div> <div class="devsite-search-shortcut-icon-container" aria-hidden="true"> <kbd class="devsite-search-shortcut-icon">/</kbd> </div> </div> </div> </form> <button type="button" search-close class="devsite-search-button devsite-header-icon-button button-flat material-icons" aria-label="Close search"></button> </devsite-search> </div> <devsite-language-selector> <ul role="presentation"> <li role="presentation"> <a role="menuitem" lang="en" >English</a> </li> <li role="presentation"> <a role="menuitem" lang="de" >Deutsch</a> </li> <li role="presentation"> <a role="menuitem" lang="es_419" >Español – América Latina</a> </li> <li role="presentation"> <a role="menuitem" lang="fr" >Français</a> </li> <li role="presentation"> <a role="menuitem" lang="id" >Indonesia</a> </li> <li role="presentation"> <a role="menuitem" lang="it" >Italiano</a> </li> <li role="presentation"> <a role="menuitem" lang="pt_br" >Português – Brasil</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_cn" >中文 – 简体</a> </li> <li role="presentation"> <a role="menuitem" lang="ja" >日本語</a> </li> <li role="presentation"> <a role="menuitem" lang="ko" >한국어</a> </li> </ul> </devsite-language-selector> <devsite-user enable-profiles fp-auth id="devsite-user"> <span class="button devsite-top-button" aria-hidden="true" visually-hidden>Sign in</span> </devsite-user> </div> </div> </div> <div class="devsite-collapsible-section "> <div class="devsite-header-background"> <div class="devsite-product-id-row" hidden> <div class="devsite-product-description-row"> </div> </div> <div class="devsite-doc-set-nav-row"> <ul class="devsite-breadcrumb-list" > <li class="devsite-breadcrumb-item "> <a href="https://cloud.google.com/storage" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Lower Header" data-value="1" track-type="globalNav" track-name="breadcrumb" track-metadata-position="1" track-metadata-eventdetail="Cloud Storage" > Cloud Storage </a> </li> </ul> <cloudx-tabs-nav class="lower-tabs"> <nav class="devsite-tabs-wrapper" aria-label="Lower tabs"> <tab class="devsite-active"> <a href="https://cloud.google.com/storage/docs/discover-object-storage-console" track-metadata-eventdetail="https://cloud.google.com/storage/docs/discover-object-storage-console" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - guides" track-metadata-module="primary nav" aria-label="Guides, selected" data-category="Site-Wide Custom Events" data-label="Tab: Guides" track-name="guides" > Guides </a> </tab> <tab > <a href="https://cloud.google.com/storage/docs/apis" track-metadata-eventdetail="https://cloud.google.com/storage/docs/apis" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - reference" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Reference" track-name="reference" > Reference </a> </tab> <tab > <a href="https://cloud.google.com/storage/docs/samples" track-metadata-eventdetail="https://cloud.google.com/storage/docs/samples" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - samples" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Samples" track-name="samples" > Samples </a> </tab> <tab > <a href="https://cloud.google.com/storage/docs/resources" track-metadata-eventdetail="https://cloud.google.com/storage/docs/resources" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - resources" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Resources" track-name="resources" > Resources </a> </tab> </nav> </cloudx-tabs-nav> <div class="devsite-product-button-row"> <a href="https://cloud.google.com/contact" class="cta-button-secondary button " data-overflow-container="left" track-type="contact" track-name="sales" data-overflow="devsite-tabs-wrapper" data-overflow-wrapper="tab" track-metadata-position="nav" track-metadata-eventDetail="nav" >Contact Us</a> <a href="//console.cloud.google.com/freetrial" class="cloud-free-trial-button cta-button-primary button-primary button cloud-button cloud-button--primary " track-type="freeTrial" track-metadata-eventDetail="nav" data-overflow-class="devsite-header-link devsite-top-button button cloud-free-trial-button cloud-free-trial-enabled cloud-button cloud-button--primary" track-name="gcpCta" referrerpolicy="no-referrer-when-downgrade" track-metadata-position="nav" data-overflow="devsite-top-logo-row" data-overflow-container="right" >Start free</a> </div> </div> </div> </div> </div> </devsite-header> <devsite-book-nav scrollbars > <div class="devsite-book-nav-filter" > <span class="filter-list-icon material-icons" aria-hidden="true"></span> <input type="text" placeholder="Filter" aria-label="Type to filter" role="searchbox"> <span class="filter-clear-button hidden" data-title="Clear filter" aria-label="Clear filter" role="button" tabindex="0"></span> </div> <nav class="devsite-book-nav devsite-nav nocontent" aria-label="Side menu"> <div class="devsite-mobile-header"> <button type="button" id="devsite-close-nav" class="devsite-header-icon-button button-flat material-icons gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Close navigation" aria-label="Close navigation"> </button> <div class="devsite-product-name-wrapper"> <a href="/" class="devsite-site-logo-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Site logo" track-type="globalNav" track-name="googleCloud" track-metadata-position="nav" track-metadata-eventDetail="nav"> <picture> <img src="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/cloud-logo.svg" class="devsite-site-logo" alt="Google Cloud"> </picture> </a> <span class="devsite-product-name"> <ul class="devsite-breadcrumb-list" > <li class="devsite-breadcrumb-item devsite-has-google-wordmark"> </li> </ul> </span> </div> </div> <div class="devsite-book-nav-wrapper"> <div class="devsite-mobile-nav-top"> <ul class="devsite-nav-list"> <li class="devsite-nav-item"> <a href="/docs" class="devsite-nav-title gc-analytics-event devsite-nav-active" data-category="Site-Wide Custom Events" data-label="Tab: Documentation" track-name="docs-home" track-link-column-type="single-column" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Documentation" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Documentation </span> </a> <ul class="devsite-nav-responsive-tabs"> <li class="devsite-nav-item"> <a href="/storage/docs/discover-object-storage-console" class="devsite-nav-title gc-analytics-event devsite-nav-has-children devsite-nav-active" data-category="Site-Wide Custom Events" data-label="Tab: Guides" track-name="guides" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Guides" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip menu="_book"> Guides </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="_book"> </span> </a> </li> <li class="devsite-nav-item"> <a href="/storage/docs/apis" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Tab: Reference" track-name="reference" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Reference" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Reference </span> <span class="devsite-nav-icon material-icons" data-icon="forward" > </span> </a> </li> <li class="devsite-nav-item"> <a href="/storage/docs/samples" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Tab: Samples" track-name="samples" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Samples" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Samples </span> <span class="devsite-nav-icon material-icons" data-icon="forward" > </span> </a> </li> <li class="devsite-nav-item"> <a href="/storage/docs/resources" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Tab: Resources" track-name="resources" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Resources" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Resources </span> <span class="devsite-nav-icon material-icons" data-icon="forward" > </span> </a> </li> </ul> </li> <li class="devsite-nav-item"> <a href="/docs/tech-area-overviews" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Technology areas" track-name="technology-areas" track-link-column-type="single-column" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Technology areas" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Technology areas </span> </a> <ul class="devsite-nav-responsive-tabs devsite-nav-has-menu "> <li class="devsite-nav-item"> <span class="devsite-nav-title" tooltip data-category="Site-Wide Custom Events" data-label="Tab: Technology areas" track-name="technology-areas" track-link-column-type="single-column" > <span class="devsite-nav-text" tooltip menu="Technology areas"> More </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="Technology areas"> </span> </span> </li> </ul> </li> <li class="devsite-nav-item"> <a href="/docs/cross-product-overviews" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Cross-product tools" track-name="crossproduct" track-link-column-type="single-column" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Cross-product tools" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Cross-product tools </span> </a> <ul class="devsite-nav-responsive-tabs devsite-nav-has-menu "> <li class="devsite-nav-item"> <span class="devsite-nav-title" tooltip data-category="Site-Wide Custom Events" data-label="Tab: Cross-product tools" track-name="crossproduct" track-link-column-type="single-column" > <span class="devsite-nav-text" tooltip menu="Cross-product tools"> More </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="Cross-product tools"> </span> </span> </li> </ul> </li> <li class="devsite-nav-item"> <a href="/" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Related sites" track-name="related-sites" track-link-column-type="single-column" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Related sites" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Related sites </span> </a> <ul class="devsite-nav-responsive-tabs devsite-nav-has-menu "> <li class="devsite-nav-item"> <span class="devsite-nav-title" tooltip data-category="Site-Wide Custom Events" data-label="Tab: Related sites" track-name="related-sites" track-link-column-type="single-column" > <span class="devsite-nav-text" tooltip menu="Related sites"> More </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="Related sites"> </span> </span> </li> </ul> </li> <li class="devsite-nav-item"> <a href="//console.cloud.google.com/" class="devsite-nav-title gc-analytics-event " track-type="globalNav" referrerpolicy="no-referrer-when-downgrade" track-name="console" track-metadata-eventDetail="nav" track-metadata-position="nav" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Console" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Console </span> </a> </li> <li class="devsite-nav-item"> <a href="/contact" class="cta-button-secondary button" data-overflow-container="left" track-type="contact" track-name="sales" data-overflow="devsite-tabs-wrapper" data-overflow-wrapper="tab" track-metadata-position="nav" track-metadata-eventDetail="nav" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Contact Us" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Contact Us </span> </a> </li> <li class="devsite-nav-item"> <a href="//console.cloud.google.com/freetrial" class="cloud-free-trial-button cta-button-primary button-primary button cloud-button cloud-button--primary" track-type="freeTrial" track-metadata-eventDetail="nav" data-overflow-class="devsite-header-link devsite-top-button button cloud-free-trial-button cloud-free-trial-enabled cloud-button cloud-button--primary" track-name="gcpCta" referrerpolicy="no-referrer-when-downgrade" track-metadata-position="nav" data-overflow="devsite-top-logo-row" data-overflow-container="right" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Start free" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Start free </span> </a> </li> </ul> </div> <div class="devsite-mobile-nav-bottom"> <ul class="devsite-nav-list" menu="_book"> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Discover</span> </div></li> <li class="devsite-nav-item"><a href="/storage/docs/introduction" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/introduction" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/introduction" ><span class="devsite-nav-text" tooltip>Product overview</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Get started</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Quickstarts</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/discover-object-storage-console" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/discover-object-storage-console" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/discover-object-storage-console" ><span class="devsite-nav-text" tooltip>Use the Console</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/discover-object-storage-gcloud" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/discover-object-storage-gcloud" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/discover-object-storage-gcloud" ><span class="devsite-nav-text" tooltip>Use the gcloud tool</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/terraform-create-bucket-upload-object" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/terraform-create-bucket-upload-object" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/terraform-create-bucket-upload-object" ><span class="devsite-nav-text" tooltip>Use Terraform</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Use client libraries</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/reference/libraries" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/reference/libraries" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/reference/libraries" ><span class="devsite-nav-text" tooltip>Get started with client libraries</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/enable-grpc-api" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/enable-grpc-api" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/enable-grpc-api" ><span class="devsite-nav-text" tooltip>Get started with gRPC</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/reference/storage_control_quickstart" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/reference/storage_control_quickstart" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/reference/storage_control_quickstart" ><span class="devsite-nav-text" tooltip>Get started with the Storage Control API</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/storage/docs/terraform-for-cloud-storage" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/terraform-for-cloud-storage" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/terraform-for-cloud-storage" ><span class="devsite-nav-text" tooltip>Terraform support for Cloud Storage</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Create storage buckets</span> </div></li> <li class="devsite-nav-item"><a href="/storage/docs/buckets" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/buckets" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/buckets" ><span class="devsite-nav-text" tooltip>About buckets</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/creating-buckets" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/creating-buckets" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/creating-buckets" ><span class="devsite-nav-text" tooltip>Create buckets</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/locations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/locations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/locations" ><span class="devsite-nav-text" tooltip>Bucket locations</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/storage-classes" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/storage-classes" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/storage-classes" ><span class="devsite-nav-text" tooltip>Storage classes</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/changing-default-storage-class" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/changing-default-storage-class" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/changing-default-storage-class" ><span class="devsite-nav-text" tooltip>Change the default storage class of a bucket</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Enable Hierarchical Namespace</span> </div></li> <li class="devsite-nav-item"><a href="/storage/docs/hns-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/hns-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/hns-overview" ><span class="devsite-nav-text" tooltip>Overview</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/create-hns-bucket" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/create-hns-bucket" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/create-hns-bucket" ><span class="devsite-nav-text" tooltip>Create and manage buckets with hierarchical namespace enabled</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Folders</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/folders-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/folders-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/folders-overview" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/create-folders" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/create-folders" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/create-folders" ><span class="devsite-nav-text" tooltip>Create and manage folders</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/rename-hns-folders" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/rename-hns-folders" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/rename-hns-folders" ><span class="devsite-nav-text" tooltip>Rename and move folders</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/storage/docs/hns-hadoop-workloads" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/hns-hadoop-workloads" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/hns-hadoop-workloads" ><span class="devsite-nav-text" tooltip>Use hierarchical namespace enabled buckets for Hadoop workloads</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/hns-buckets-best-practices" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/hns-buckets-best-practices" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/hns-buckets-best-practices" ><span class="devsite-nav-text" tooltip>Optimize performance</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Manage storage buckets</span> </div></li> <li class="devsite-nav-item"><a href="/storage/docs/listing-buckets" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/listing-buckets" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/listing-buckets" ><span class="devsite-nav-text" tooltip>List buckets</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Bucket metadata</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/bucket-metadata" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/bucket-metadata" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/bucket-metadata" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/getting-bucket-metadata" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/getting-bucket-metadata" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/getting-bucket-metadata" ><span class="devsite-nav-text" tooltip>Get bucket metadata</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/getting-bucket-size" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/getting-bucket-size" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/getting-bucket-size" ><span class="devsite-nav-text" tooltip>Get bucket size</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/getting-storage-layout" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/getting-storage-layout" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/getting-storage-layout" ><span class="devsite-nav-text" tooltip>Get bucket storage layout</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Tags and labels</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/tags-and-labels" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/tags-and-labels" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/tags-and-labels" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/using-bucket-labels" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/using-bucket-labels" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/using-bucket-labels" ><span class="devsite-nav-text" tooltip>Label buckets</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/storage/docs/moving-buckets" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/moving-buckets" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/moving-buckets" ><span class="devsite-nav-text" tooltip>Move and rename buckets</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/deleting-buckets" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/deleting-buckets" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/deleting-buckets" ><span class="devsite-nav-text" tooltip>Delete buckets</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/domain-name-verification" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/domain-name-verification" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/domain-name-verification" ><span class="devsite-nav-text" tooltip>Domain-named bucket verification</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Upload and download objects</span> </div></li> <li class="devsite-nav-item"><a href="/storage/docs/objects" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/objects" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/objects" ><span class="devsite-nav-text" tooltip>About objects</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/uploads-downloads" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/uploads-downloads" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/uploads-downloads" ><span class="devsite-nav-text" tooltip>Overview of uploads and downloads</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Download objects</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/downloading-objects" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/downloading-objects" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/downloading-objects" ><span class="devsite-nav-text" tooltip>Download objects as files</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/downloading-objects-into-memory" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/downloading-objects-into-memory" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/downloading-objects-into-memory" ><span class="devsite-nav-text" tooltip>Download objects into memory</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/sliced-object-downloads" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/sliced-object-downloads" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/sliced-object-downloads" ><span class="devsite-nav-text" tooltip>Sliced object downloads</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/streaming-downloads" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/streaming-downloads" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/streaming-downloads" ><span class="devsite-nav-text" tooltip>Streaming downloads</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Upload objects</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/uploading-objects" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/uploading-objects" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/uploading-objects" ><span class="devsite-nav-text" tooltip>Upload objects from files</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/uploading-objects-from-memory" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/uploading-objects-from-memory" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/uploading-objects-from-memory" ><span class="devsite-nav-text" tooltip>Upload objects from memory</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Resumable uploads</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/resumable-uploads" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/resumable-uploads" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/resumable-uploads" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/performing-resumable-uploads" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/performing-resumable-uploads" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/performing-resumable-uploads" ><span class="devsite-nav-text" tooltip>Perform resumable uploads</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/storage/docs/multipart-uploads" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/multipart-uploads" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/multipart-uploads" ><span class="devsite-nav-text" tooltip>XML API multipart uploads</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/parallel-composite-uploads" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/parallel-composite-uploads" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/parallel-composite-uploads" ><span class="devsite-nav-text" tooltip>Parallel composite uploads</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/streaming-uploads" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/streaming-uploads" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/streaming-uploads" ><span class="devsite-nav-text" tooltip>Streaming uploads</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Composite objects</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/composite-objects" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/composite-objects" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/composite-objects" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/composing-objects" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/composing-objects" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/composing-objects" ><span class="devsite-nav-text" tooltip>Compose objects</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Manage objects</span> </div></li> <li class="devsite-nav-item"><a href="/storage/docs/changing-storage-classes" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/changing-storage-classes" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/changing-storage-classes" ><span class="devsite-nav-text" tooltip>Change an object&#39;s storage class</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/listing-objects" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/listing-objects" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/listing-objects" ><span class="devsite-nav-text" tooltip>List objects</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Object metadata</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/metadata" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/metadata" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/metadata" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/viewing-editing-metadata" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/viewing-editing-metadata" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/viewing-editing-metadata" ><span class="devsite-nav-text" tooltip>View and edit object metadata</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/storage/docs/copying-renaming-moving-objects" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/copying-renaming-moving-objects" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/copying-renaming-moving-objects" ><span class="devsite-nav-text" tooltip>Copy, rename, and move objects</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/deleting-objects" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/deleting-objects" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/deleting-objects" ><span class="devsite-nav-text" tooltip>Delete objects</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/caching" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/caching" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/caching" ><span class="devsite-nav-text" tooltip>Caching objects</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Get insights about objects</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/insights/inventory-reports" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/insights/inventory-reports" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/insights/inventory-reports" ><span class="devsite-nav-text" tooltip>Overview of inventory reports</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/insights/using-inventory-reports" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/insights/using-inventory-reports" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/insights/using-inventory-reports" ><span class="devsite-nav-text" tooltip>Create and manage inventory reports</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/storage/docs/transcoding" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/transcoding" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/transcoding" ><span class="devsite-nav-text" tooltip>Object transcoding</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Control data lifecycles</span> </div></li> <li class="devsite-nav-item"><a href="/storage/docs/control-data-lifecycles" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/control-data-lifecycles" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/control-data-lifecycles" ><span class="devsite-nav-text" tooltip>Options for controlling data lifecycles</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Object Lifecycle Management feature</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/lifecycle" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/lifecycle" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/lifecycle" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/managing-lifecycles" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/managing-lifecycles" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/managing-lifecycles" ><span class="devsite-nav-text" tooltip>Manage object lifecycles</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/lifecycle-configurations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/lifecycle-configurations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/lifecycle-configurations" ><span class="devsite-nav-text" tooltip>Configuration examples</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Autoclass feature</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/autoclass" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/autoclass" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/autoclass" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/using-autoclass" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/using-autoclass" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/using-autoclass" ><span class="devsite-nav-text" tooltip>Use Autoclass</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Object Versioning feature</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/object-versioning" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/object-versioning" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/object-versioning" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/using-object-versioning" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/using-object-versioning" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/using-object-versioning" ><span class="devsite-nav-text" tooltip>Use the Object Versioning feature</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/using-versioned-objects" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/using-versioned-objects" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/using-versioned-objects" ><span class="devsite-nav-text" tooltip>Use versioned objects</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Make requests</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Request endpoints</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/request-endpoints" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/request-endpoints" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/request-endpoints" ><span class="devsite-nav-text" tooltip>Global endpoints</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/regional-endpoints" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/regional-endpoints" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/regional-endpoints" ><span class="devsite-nav-text" tooltip>Regional endpoints</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/locational-endpoints" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/locational-endpoints" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/locational-endpoints" ><span class="devsite-nav-text" tooltip>Locational endpoints for ITAR</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Authenticating and OAuth</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/authentication" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/authentication" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/authentication" ><span class="devsite-nav-text" tooltip>Authenticating requests</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/user-accounts" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/user-accounts" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/user-accounts" ><span class="devsite-nav-text" tooltip>Accessing data on a user&#39;s behalf</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/oauth-scopes" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/oauth-scopes" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/oauth-scopes" ><span class="devsite-nav-text" tooltip>OAuth 2.0 scopes</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Validate and retry requests</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/request-rate" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/request-rate" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/request-rate" ><span class="devsite-nav-text" tooltip>Request rate and access distribution guidelines</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/retry-strategy" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/retry-strategy" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/retry-strategy" ><span class="devsite-nav-text" tooltip>Retry strategy</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/request-preconditions" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/request-preconditions" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/request-preconditions" ><span class="devsite-nav-text" tooltip>Request preconditions</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/data-validation" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/data-validation" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/data-validation" ><span class="devsite-nav-text" tooltip>Data validation and change detection</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/storage/docs/consistency" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/consistency" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/consistency" ><span class="devsite-nav-text" tooltip>Consistency in Cloud Storage operations</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/batch" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/batch" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/batch" ><span class="devsite-nav-text" tooltip>Batched requests</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Requester Pays feature</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/requester-pays" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/requester-pays" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/requester-pays" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/using-requester-pays" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/using-requester-pays" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/using-requester-pays" ><span class="devsite-nav-text" tooltip>Use the Requester Pays feature</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/storage/docs/using-long-running-operations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/using-long-running-operations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/using-long-running-operations" ><span class="devsite-nav-text" tooltip>Use long-running operations</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/paginate-results" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/paginate-results" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/paginate-results" ><span class="devsite-nav-text" tooltip>Paginate results</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/wildcards" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/wildcards" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/wildcards" ><span class="devsite-nav-text" tooltip>URI wildcards</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Secure data</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Access control</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/access-control" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/access-control" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/access-control" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Control public access to data</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/access-control/making-data-public" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/access-control/making-data-public" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/access-control/making-data-public" ><span class="devsite-nav-text" tooltip>Make data public</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/access-public-data" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/access-public-data" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/access-public-data" ><span class="devsite-nav-text" tooltip>Access public data</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Public access prevention</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/public-access-prevention" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/public-access-prevention" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/public-access-prevention" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/using-public-access-prevention" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/using-public-access-prevention" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/using-public-access-prevention" ><span class="devsite-nav-text" tooltip>Use public access prevention</span></a></li></ul></div></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Cloud Identity and Access Management (Cloud IAM)</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/access-control/iam" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/access-control/iam" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/access-control/iam" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/access-control/using-iam-permissions" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/access-control/using-iam-permissions" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/access-control/using-iam-permissions" ><span class="devsite-nav-text" tooltip>Set IAM policies on buckets</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/access-control/using-iam-for-managed-folders" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/access-control/using-iam-for-managed-folders" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/access-control/using-iam-for-managed-folders" ><span class="devsite-nav-text" tooltip>Set IAM policies on managed folders</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/access-control/iam-reference" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/access-control/iam-reference" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/access-control/iam-reference" ><span class="devsite-nav-text" tooltip>IAM references for Cloud Storage</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Managed folders</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/managed-folders" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/managed-folders" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/managed-folders" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/creating-managing-managed-folders" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/creating-managing-managed-folders" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/creating-managing-managed-folders" ><span class="devsite-nav-text" tooltip>Create and manage managed folders</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Access control lists (ACLs)</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/access-control/lists" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/access-control/lists" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/access-control/lists" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/access-control/create-manage-lists" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/access-control/create-manage-lists" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/access-control/create-manage-lists" ><span class="devsite-nav-text" tooltip>Create and manage ACLs</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable devsite-nav-preview"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Bucket IP filtering</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/ip-filtering-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/ip-filtering-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/ip-filtering-overview" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/create-ip-filter" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/create-ip-filter" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/create-ip-filter" ><span class="devsite-nav-text" tooltip>Create bucket IP filtering rules</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/update-ip-filter" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/update-ip-filter" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/update-ip-filter" ><span class="devsite-nav-text" tooltip>Update bucket IP filtering rules</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/get-ip-filter" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/get-ip-filter" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/get-ip-filter" ><span class="devsite-nav-text" tooltip>Get IP bucket filtering rules</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/list-ip-filter" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/list-ip-filter" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/list-ip-filter" ><span class="devsite-nav-text" tooltip>List bucket IP filtering rules</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/disable-ip-filtering" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/disable-ip-filtering" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/disable-ip-filtering" ><span class="devsite-nav-text" tooltip>Disable bucket IP filtering</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/bypass-ip-filter" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/bypass-ip-filter" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/bypass-ip-filter" ><span class="devsite-nav-text" tooltip>Bypass bucket IP filtering rules</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Uniform bucket-level access</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/uniform-bucket-level-access" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/uniform-bucket-level-access" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/uniform-bucket-level-access" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/using-uniform-bucket-level-access" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/using-uniform-bucket-level-access" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/using-uniform-bucket-level-access" ><span class="devsite-nav-text" tooltip>Use uniform bucket-level access</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/storage/docs/collaboration" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/collaboration" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/collaboration" ><span class="devsite-nav-text" tooltip>Sharing and collaboration scenarios</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Cross-origin resource sharing (CORS)</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/cross-origin" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/cross-origin" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/cross-origin" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/using-cors" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/using-cors" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/using-cors" ><span class="devsite-nav-text" tooltip>Set up and view CORS configurations</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/cors-configurations" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/cors-configurations" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/cors-configurations" ><span class="devsite-nav-text" tooltip>CORS configuration examples</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Authenticate with V4 signing</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/access-control/signed-urls" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/access-control/signed-urls" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/access-control/signed-urls" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/access-control/signing-urls-with-helpers" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/access-control/signing-urls-with-helpers" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/access-control/signing-urls-with-helpers" ><span class="devsite-nav-text" tooltip>V4 signing process with Cloud Storage tools</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/access-control/signing-urls-manually" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/access-control/signing-urls-manually" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/access-control/signing-urls-manually" ><span class="devsite-nav-text" tooltip>V4 signing process with your own program</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/authentication/canonical-requests" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/authentication/canonical-requests" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/authentication/canonical-requests" ><span class="devsite-nav-text" tooltip>Canonical requests</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/authentication/signatures" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/authentication/signatures" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/authentication/signatures" ><span class="devsite-nav-text" tooltip>Signatures</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/authentication/creating-signatures" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/authentication/creating-signatures" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/authentication/creating-signatures" ><span class="devsite-nav-text" tooltip>Create signatures</span></a></li></ul></div></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Encryption</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/encryption" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/encryption" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/encryption" ><span class="devsite-nav-text" tooltip>Data encryption options</span></a></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Customer-managed encryption keys</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/encryption/customer-managed-keys" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/encryption/customer-managed-keys" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/encryption/customer-managed-keys" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/encryption/using-customer-managed-keys" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/encryption/using-customer-managed-keys" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/encryption/using-customer-managed-keys" ><span class="devsite-nav-text" tooltip>Use customer-managed encryption keys</span></a></li></ul></div></li><li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Customer-supplied encryption keys</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/encryption/customer-supplied-keys" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/encryption/customer-supplied-keys" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/encryption/customer-supplied-keys" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/encryption/using-customer-supplied-keys" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/encryption/using-customer-supplied-keys" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/encryption/using-customer-supplied-keys" ><span class="devsite-nav-text" tooltip>Use customer-supplied encryption keys</span></a></li></ul></div></li><li class="devsite-nav-item"><a href="/storage/docs/encryption/default-keys" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/encryption/default-keys" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/encryption/default-keys" ><span class="devsite-nav-text" tooltip>Standard encryption</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/encryption/client-side-keys" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/encryption/client-side-keys" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/encryption/client-side-keys" ><span class="devsite-nav-text" tooltip>Client-side keys</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Organization policy constraints</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/org-policy-constraints" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/org-policy-constraints" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/org-policy-constraints" ><span class="devsite-nav-text" tooltip>Predefined constraints</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/custom-constraints" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/custom-constraints" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/custom-constraints" ><span class="devsite-nav-text" tooltip>Custom constraints</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Monitor data and usage</span> </div></li> <li class="devsite-nav-item"><a href="/storage/docs/monitoring" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/monitoring" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/monitoring" ><span class="devsite-nav-text" tooltip>Bucket monitoring</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/bandwidth-usage" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/bandwidth-usage" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/bandwidth-usage" ><span class="devsite-nav-text" tooltip>Monitor bandwidth usage</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Pub/Sub notifications for Cloud Storage</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/pubsub-notifications" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/pubsub-notifications" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/pubsub-notifications" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/reporting-changes" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/reporting-changes" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/reporting-changes" ><span class="devsite-nav-text" tooltip>Configure Pub/Sub notifications</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/storage/docs/audit-logging" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/audit-logging" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/audit-logging" ><span class="devsite-nav-text" tooltip>Use Cloud Audit Logs with Cloud Storage</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/access-logs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/access-logs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/access-logs" ><span class="devsite-nav-text" tooltip>Usage logs and storage logs</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/insights/audit-logging" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/insights/audit-logging" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/insights/audit-logging" ><span class="devsite-nav-text" tooltip>Use Cloud Audit Logs with Storage Insights</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/client-side-metrics" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/client-side-metrics" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/client-side-metrics" ><span class="devsite-nav-text" tooltip>Use gRPC client-side metrics</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Protection, backup, and recovery</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Object holds</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/object-holds" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/object-holds" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/object-holds" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/holding-objects" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/holding-objects" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/holding-objects" ><span class="devsite-nav-text" tooltip>Use object holds</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Soft Delete</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/soft-delete" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/soft-delete" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/soft-delete" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/use-soft-delete" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/use-soft-delete" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/use-soft-delete" ><span class="devsite-nav-text" tooltip>Set and manage soft delete policies</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/use-soft-deleted-objects" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/use-soft-deleted-objects" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/use-soft-deleted-objects" ><span class="devsite-nav-text" tooltip>Use soft-deleted objects</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/use-soft-deleted-buckets" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/use-soft-deleted-buckets" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/use-soft-deleted-buckets" ><span class="devsite-nav-text" tooltip>Use soft-deleted buckets</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/use-tags-for-soft-delete" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/use-tags-for-soft-delete" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/use-tags-for-soft-delete" ><span class="devsite-nav-text" tooltip>Set a default soft delete retention duration</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/soft-delete-recommender" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/soft-delete-recommender" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/soft-delete-recommender" ><span class="devsite-nav-text" tooltip>Use soft delete recommendations</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/disable-soft-delete" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/disable-soft-delete" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/disable-soft-delete" ><span class="devsite-nav-text" tooltip>Disable soft delete</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Bucket Lock</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/bucket-lock" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/bucket-lock" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/bucket-lock" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/using-bucket-lock" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/using-bucket-lock" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/using-bucket-lock" ><span class="devsite-nav-text" tooltip>Use and lock retention policies</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Object Retention Lock</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/object-lock" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/object-lock" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/object-lock" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/using-object-lock" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/using-object-lock" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/using-object-lock" ><span class="devsite-nav-text" tooltip>Enable and use object retention configurations</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Availability and durability</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/availability-durability" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/availability-durability" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/availability-durability" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/managing-turbo-replication" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/managing-turbo-replication" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/managing-turbo-replication" ><span class="devsite-nav-text" tooltip>Manage turbo replication</span></a></li><li class="devsite-nav-item devsite-nav-preview"><a href="/storage/docs/using-cross-bucket-replication" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/using-cross-bucket-replication" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/using-cross-bucket-replication" ><span class="devsite-nav-text" tooltip>Use cross-bucket replication</span><span class="devsite-nav-icon material-icons" data-icon="preview" data-title="Preview" aria-hidden="true"></span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Mount buckets with Cloud Storage FUSE</span> </div></li> <li class="devsite-nav-item"><a href="/storage/docs/cloud-storage-fuse/overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/cloud-storage-fuse/overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/cloud-storage-fuse/overview" ><span class="devsite-nav-text" tooltip>Overview</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/cloud-storage-fuse/quickstart-mount-bucket" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/cloud-storage-fuse/quickstart-mount-bucket" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/cloud-storage-fuse/quickstart-mount-bucket" ><span class="devsite-nav-text" tooltip>Quickstart</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/cloud-storage-fuse/install" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/cloud-storage-fuse/install" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/cloud-storage-fuse/install" ><span class="devsite-nav-text" tooltip>Install Cloud Storage FUSE</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/cloud-storage-fuse/mount-bucket" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/cloud-storage-fuse/mount-bucket" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/cloud-storage-fuse/mount-bucket" ><span class="devsite-nav-text" tooltip>Mount buckets</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Caching</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/cloud-storage-fuse/caching" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/cloud-storage-fuse/caching" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/cloud-storage-fuse/caching" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/cloud-storage-fuse/file-caching" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/cloud-storage-fuse/file-caching" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/cloud-storage-fuse/file-caching" ><span class="devsite-nav-text" tooltip>Use file caching</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/storage/docs/cloud-storage-fuse/performance" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/cloud-storage-fuse/performance" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/cloud-storage-fuse/performance" ><span class="devsite-nav-text" tooltip>Performance</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Work across products, Clouds, and platforms</span> </div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Projects</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/projects" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/projects" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/projects" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/getting-service-agent" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/getting-service-agent" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/getting-service-agent" ><span class="devsite-nav-text" tooltip>Get a service agent</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Serve website content</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/hosting-static-website" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/hosting-static-website" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/hosting-static-website" ><span class="devsite-nav-text" tooltip>Host a static website</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/static-website" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/static-website" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/static-website" ><span class="devsite-nav-text" tooltip>Static website example and tips</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Migrate from Amazon S3 to Cloud Storage</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/aws-simple-migration" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/aws-simple-migration" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/aws-simple-migration" ><span class="devsite-nav-text" tooltip>Simple migration</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/migrating" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/migrating" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/migrating" ><span class="devsite-nav-text" tooltip>Full migration</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/storage/docs/interoperability" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/interoperability" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/interoperability" ><span class="devsite-nav-text" tooltip>Interoperability</span></a></li> <li class="devsite-nav-item devsite-nav-expandable"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>HMAC keys</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/storage/docs/authentication/hmackeys" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/authentication/hmackeys" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/authentication/hmackeys" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/storage/docs/authentication/managing-hmackeys" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/authentication/managing-hmackeys" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/authentication/managing-hmackeys" ><span class="devsite-nav-text" tooltip>Manage HMAC keys for service accounts</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/storage/docs/working-with-big-data" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/working-with-big-data" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/working-with-big-data" ><span class="devsite-nav-text" tooltip>Use Cloud Storage with Big Data</span></a></li> <li class="devsite-nav-item"><a href="/storage/docs/google-integration" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/google-integration" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/google-integration" ><span class="devsite-nav-text" tooltip>Integration with Google Cloud Platform services and tools</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Troubleshoot</span> </div></li> <li class="devsite-nav-item"><a href="/storage/docs/troubleshooting" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /storage/docs/troubleshooting" track-type="bookNav" track-name="click" track-metadata-eventdetail="/storage/docs/troubleshooting" ><span class="devsite-nav-text" tooltip>Troubleshooting</span></a></li> </ul> <ul class="devsite-nav-list" menu="Technology areas" aria-label="Side menu" hidden> <li class="devsite-nav-item"> <a href="/docs/ai-ml" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: AI and ML" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > AI and ML </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/application-development" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Application development" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Application development </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/application-hosting" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Application hosting" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Application hosting </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/compute-area" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Compute" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Compute </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/data" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Data analytics and pipelines" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Data analytics and pipelines </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/databases" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Databases" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Databases </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/dhm-cloud" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Distributed, hybrid, and multicloud" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Distributed, hybrid, and multicloud </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/generative-ai" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Generative AI" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Generative AI </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/industry" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Industry solutions" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Industry solutions </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/networking" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Networking" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Networking </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/observability" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Observability and monitoring" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Observability and monitoring </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/security" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Security" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Security </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/storage" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Storage" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Storage </span> </a> </li> </ul> <ul class="devsite-nav-list" menu="Cross-product tools" aria-label="Side menu" hidden> <li class="devsite-nav-item"> <a href="/docs/access-resources" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Access and resources management" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Access and resources management </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/costs-usage" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Costs and usage management" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Costs and usage management </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/devtools" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud SDK, languages, frameworks, and tools" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud SDK, languages, frameworks, and tools </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/iac" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Infrastructure as code" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Infrastructure as code </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/migration" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Migration" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Migration </span> </a> </li> </ul> <ul class="devsite-nav-list" menu="Related sites" aria-label="Side menu" hidden> <li class="devsite-nav-item"> <a href="/" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Home" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Home </span> </a> </li> <li class="devsite-nav-item"> <a href="/free" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Free Trial and Free Tier" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Free Trial and Free Tier </span> </a> </li> <li class="devsite-nav-item"> <a href="/architecture" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Architecture Center" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Architecture Center </span> </a> </li> <li class="devsite-nav-item"> <a href="https://cloud.google.com/blog" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Blog" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Blog </span> </a> </li> <li class="devsite-nav-item"> <a href="/contact" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Contact Sales" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Contact Sales </span> </a> </li> <li class="devsite-nav-item"> <a href="/developers" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Developer Center" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Developer Center </span> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.google.com/" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Developer Center" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Developer Center </span> </a> </li> <li class="devsite-nav-item"> <a href="https://console.cloud.google.com/marketplace" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Marketplace" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Marketplace </span> </a> </li> <li class="devsite-nav-item"> <a href="/marketplace/docs" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Marketplace Documentation" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Marketplace Documentation </span> </a> </li> <li class="devsite-nav-item"> <a href="https://www.cloudskillsboost.google/paths" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Skills Boost" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Skills Boost </span> </a> </li> <li class="devsite-nav-item"> <a href="/solutions" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Solution Center" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Solution Center </span> </a> </li> <li class="devsite-nav-item"> <a href="/support-hub" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Support" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Support </span> </a> </li> <li class="devsite-nav-item"> <a href="https://www.youtube.com/@googlecloudtech" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Cloud Tech Youtube Channel" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Cloud Tech Youtube Channel </span> </a> </li> </ul> </div> </div> </nav> </devsite-book-nav> <section id="gc-wrapper"> <main role="main" class="devsite-main-content" has-book-nav has-sidebar > <div class="devsite-sidebar"> <div class="devsite-sidebar-content"> <devsite-toc class="devsite-nav" role="navigation" aria-label="On this page" depth="2" scrollbars ></devsite-toc> <devsite-recommendations-sidebar class="nocontent devsite-nav"> </devsite-recommendations-sidebar> </div> </div> <devsite-content> <article class="devsite-article"> <div class="devsite-article-meta nocontent" role="navigation"> <ul class="devsite-breadcrumb-list" aria-label="Breadcrumb"> <li class="devsite-breadcrumb-item "> <a href="https://cloud.google.com/" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="1" track-type="globalNav" track-name="breadcrumb" track-metadata-position="1" track-metadata-eventdetail="Google Cloud" > Home </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://cloud.google.com/storage" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="2" track-type="globalNav" track-name="breadcrumb" track-metadata-position="2" track-metadata-eventdetail="Cloud Storage" > Cloud Storage </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://cloud.google.com/storage/docs" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="3" track-type="globalNav" track-name="breadcrumb" track-metadata-position="3" track-metadata-eventdetail="Cloud Storage" > Documentation </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://cloud.google.com/storage/docs/discover-object-storage-console" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="4" track-type="globalNav" track-name="breadcrumb" track-metadata-position="4" track-metadata-eventdetail="" > Guides </a> </li> </ul> <devsite-thumb-rating position="header"> </devsite-thumb-rating> </div> <devsite-feedback position="header" project-name="Cloud Storage" product-id="81864" bucket="documentation" context="" version="t-devsite-webserver-20241114-r00-rc02.464922260396498922" data-label="Send Feedback Button" track-type="feedback" track-name="sendFeedbackLink" track-metadata-position="header" class="nocontent" project-feedback-url="https://issuetracker.google.com/issues/new?component=187243" project-icon="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/super_cloud.png" project-support-url="https://cloud.google.com/support-hub" > <button> Send feedback </button> </devsite-feedback> <h1 class="devsite-page-title" tabindex="-1"> Enable and use object retention configurations </h1> <devsite-feature-tooltip ack-key="AckCollectionsBookmarkTooltipDismiss" analytics-category="Site-Wide Custom Events" analytics-action-show="Callout Profile displayed" analytics-action-close="Callout Profile dismissed" analytics-label="Create Collection Callout" class="devsite-page-bookmark-tooltip nocontent" dismiss-button="true" id="devsite-collections-dropdown" dismiss-button-text="Dismiss" close-button-text="Got it"> <devsite-bookmark></devsite-bookmark> <span slot="popout-heading"> Stay organized with collections </span> <span slot="popout-contents"> Save and categorize content based on your preferences. </span> </devsite-feature-tooltip> <div class="devsite-page-title-meta"><devsite-view-release-notes></devsite-view-release-notes></div> <devsite-toc class="devsite-nav" depth="2" devsite-toc-embedded > </devsite-toc> <div class="devsite-article-body clearfix "> <p><a class="button" href="/storage/docs/object-lock" track-type="tasks" track-name="internalLink" track-metadata-position="introParagraph">Overview</a></p> <p>This page describes how to use the Object Retention Lock feature, including enabling it for a bucket and setting retention configurations for objects within the bucket.</p> <h2 id="required-roles" data-text="Required roles" tabindex="-1">Required roles</h2> <p>To get the permissions that you need to enable the Object Retention Lock feature for a bucket and set retention configurations on objects, ask your administrator to grant you the Storage Admin (<code translate="no" dir="ltr">roles/storage.admin</code>) IAM role on the bucket or the project that contains the bucket. This <a href="/iam/docs/understanding-roles#predefined">predefined role</a> contains the permissions required to set and manage retention configurations. To see the exact permissions that are required, expand the <strong>Required permissions</strong> section:</p> <div> <devsite-expandable id="roles-and-permissions"> <h4 class="showalways" id="required-permissions" data-text="Required permissions" tabindex="-1">Required permissions</h4> <ul> <li><code translate="no" dir="ltr">storage.buckets.create</code></li> <li><code translate="no" dir="ltr">storage.buckets.enableObjectRetention</code></li> <li><code translate="no" dir="ltr">storage.buckets.get</code></li> <li><code translate="no" dir="ltr">storage.buckets.list</code> <ul><li>This permission is only required if you plan on using the Google Cloud console to perform the instructions on this page.</li></ul></li> <li><code translate="no" dir="ltr">storage.objects.get</code></li> <li><code translate="no" dir="ltr">storage.objects.list</code> <ul><li>This permission is only required if you plan on using the Google Cloud console to perform the instructions on this page.</li></ul></li> <li><code translate="no" dir="ltr">storage.objects.overrideUnlockedRetention</code> <ul><li>This permission is only required if you plan on locking or shortening an existing retention configuration.</li></ul></li> <li><code translate="no" dir="ltr">storage.objects.setRetention</code></li> <li><code translate="no" dir="ltr">storage.objects.update</code></li> </ul> </devsite-expandable> </div> <p>You might also be able to get these permissions with <a href="/iam/docs/creating-custom-roles">custom roles</a>.</p> <p>For information about granting roles on buckets, see <a href="/storage/docs/access-control/using-iam-permissions#bucket-iam">Use IAM with buckets</a>. For information about granting roles on projects, see <a href="/iam/docs/granting-changing-revoking-access">Manage access to projects</a>.</p> <h2 id="enable-retentions" data-text="Enable object retentions for a bucket" tabindex="-1">Enable object retentions for a bucket</h2> <aside class="special"><strong>Important:</strong><span> Once the ability to set object retention configurations is enabled on a bucket, it cannot be disabled.</span></aside> <p>Use the following instructions to allow retention configurations for objects in a bucket. If you want to enable object retention configurations for an existing bucket, you must follow the Google Cloud console instructions.</p> <div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="console" data-text="Console" tabindex="-1">Console</h3><p><strong>To enable object retention configurations for a new bucket</strong>:</p> <ol> <li><a href="/storage/docs/creating-buckets">Create a bucket</a> as you normally would, and in the <strong>Choose how to protect object data</strong> step, select <strong>Retention (For compliance)</strong> followed by <strong>Enable object retention</strong>.</li> </ol> <p><strong>To enable object retention configurations for an existing bucket</strong>:</p> <ol> <li>In the Google Cloud console, go to the Cloud Storage <b>Buckets</b> page.<br> <p><a class="button button-primary" href="https://console.cloud.google.com/storage/browser" target="console">Go to Buckets</a></p></li> <li><p>In the list of buckets, click the name of the bucket for which you want to enable object retentions.</p></li> <li><p>Select the <strong>Protection</strong> tab near the top of the page.</p> <p>The bucket&#39;s object retention status is displayed in the <strong>Object retention</strong> section.</p></li> <li><p>In the <strong>Object retention</strong> section, click <strong>Object Retention Not Enabled</strong>.</p></li> <li><p>In the dialog that appears, click <strong>Confirm</strong>.</p></li> </ol></section> <section><h3 id="command-line" data-text="Command line" tabindex="-1">Command line</h3><p><a href="/sdk/gcloud/reference/storage/buckets/create">Create a bucket</a> as you normally would, and include the <code translate="no" dir="ltr">--enable-per-object-retention</code> flag in the command.</p></section> <section><h3 id="client-libraries" data-text="Client libraries" tabindex="-1">Client libraries</h3><p> <section> <div id="storage-set-bucket-object-retentions-code-sample" class="ds-selector-tabs" data-ds-scope="code-sample"> <section> <h3 id="storage-set-bucket-object-retentions-cpp" track-metadata-position="storage-set-bucket-object-retentions" track-metadata-region-tag="storage-set-bucket-object-retentions" data-text="C++" tabindex="-1"><span class="notranslate">C++</span></h3> <p> For more information, see the <a href="/cpp/docs/reference/storage/latest" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="cpp" track-metadata-snippet-file-url="https://github.com/googleapis/google-cloud-cpp/blob/HEAD/google/cloud/storage/examples/storage_bucket_object_retention_samples.cc" track-metadata-region-tag="storage-set-bucket-object-retentions">Cloud Storage <span class="notranslate">C++</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="googleapis/google-cloud-cpp/google/cloud/storage/examples/storage_bucket_object_retention_samples.cc/HEAD/storage_create_bucket_with_object_retention" data-code-snippet="true" data-github-includecode-link="https://github.com/googleapis/google-cloud-cpp/blob/HEAD/google/cloud/storage/examples/storage_bucket_object_retention_samples.cc" feedback-context="{&#34;language&#34;: &#34;cpp&#34;, &#34;region_tag&#34;: &#34;storage-set-bucket-object-retentions&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/googleapis/google-cloud-cpp/blob/HEAD/google/cloud/storage/examples/storage_bucket_object_retention_samples.cc&#34;}" feedback-product="1634365" feedback-bucket="storage" language="cpp" data-github-path="googleapis/google-cloud-cpp/google/cloud/storage/examples/storage_bucket_object_retention_samples.cc" data-git-revision="HEAD" data-region-tag="storage_create_bucket_with_object_retention" dir="ltr" is-upgraded syntax="C++"><code translate="no" dir="ltr"><span class="devsite-syntax-c1">//! [create-bucket-with-object-retention]</span> <span class="devsite-syntax-k">namespace</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">gcs</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-nn">google</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-nn">cloud</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-nn">storage</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">google</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">cloud</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">StatusOr</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-p">[](</span><span class="devsite-syntax-n">gcs</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">Client</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">client</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">const</span>&amp;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">const</span>&amp;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">auto</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">client</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">CreateBucket</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">gcs</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">BucketMetadata</span><span class="devsite-syntax-p">{},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">gcs</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">EnableObjectRetention</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nb">true</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">gcs</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">OverrideDefaultProject</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project_id</span><span class="devsite-syntax-p">));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-o">!</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">move</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-n">status</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-o">!</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">-</span>&gt;<span class="devsite-syntax-n">has_object_retention</span><span class="devsite-syntax-p">())</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">runtime_error</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"missing object retention in new bucket"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">cout</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-s">"Successfully created bucket "</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-n">bucket_name</span> <span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-s">" with object retention: "</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">-</span>&gt;<span class="devsite-syntax-n">object_retention</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-s">"</span><span class="devsite-syntax-se">\n</span><span class="devsite-syntax-s">"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-p">}</span> <span class="devsite-syntax-c1">//! [create-bucket-with-object-retention]</span></code></pre></devsite-code> </div> </section> <section> <h3 id="storage-set-bucket-object-retentions-csharp" track-metadata-position="storage-set-bucket-object-retentions" track-metadata-region-tag="storage-set-bucket-object-retentions" data-text="C#" tabindex="-1"><span class="notranslate">C#</span></h3> <p> For more information, see the <a href="https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Storage.V1/latest" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="csharp" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob//storage/api/Storage.Samples/CreateBucketWithObjectRetention.cs" track-metadata-region-tag="storage-set-bucket-object-retentions">Cloud Storage <span class="notranslate">C#</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/dotnet-docs-samples/storage/api/Storage.Samples/CreateBucketWithObjectRetention.cs/HEAD/storage_create_bucket_with_object_retention" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob/HEAD/storage/api/Storage.Samples/CreateBucketWithObjectRetention.cs" feedback-context="{&#34;language&#34;: &#34;csharp&#34;, &#34;region_tag&#34;: &#34;storage-set-bucket-object-retentions&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob/HEAD/storage/api/Storage.Samples/CreateBucketWithObjectRetention.cs&#34;}" feedback-product="1634365" feedback-bucket="storage" language="csharp" data-github-path="GoogleCloudPlatform/dotnet-docs-samples/storage/api/Storage.Samples/CreateBucketWithObjectRetention.cs" data-git-revision="HEAD" data-region-tag="storage_create_bucket_with_object_retention" dir="ltr" is-upgraded syntax="C#"><code translate="no" dir="ltr"> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">Google.Apis.Storage.v1.Data</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">Google.Cloud.Storage.V1</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">System</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">class</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nc">CreateBucketWithObjectRetentionSample</span> <span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Bucket</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">CreateBucketWithObjectRetention</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"your-project-id"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucketName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"your-unique-bucket-name"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">var</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">StorageClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Create</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">var</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">CreateBucket</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucketName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">CreateBucketOptions</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">ObjectRetentionEnabled</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">true</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Created {bucketName}, with Object Retention enabled."</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span> </code></pre></devsite-code> </div> </section> <section> <h3 id="storage-set-bucket-object-retentions-java" track-metadata-position="storage-set-bucket-object-retentions" track-metadata-region-tag="storage-set-bucket-object-retentions" data-text="Java" tabindex="-1"><span class="notranslate">Java</span></h3> <p> For more information, see the <a href="https://cloud.google.com/java/docs/reference/google-cloud-storage/latest/overview" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="java" track-metadata-snippet-file-url="https://github.com/googleapis/java-storage/blob//samples/snippets/src/main/java/com/example/storage/bucket/CreateBucketWithObjectRetention.java" track-metadata-region-tag="storage-set-bucket-object-retentions">Cloud Storage <span class="notranslate">Java</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="googleapis/java-storage/samples/snippets/src/main/java/com/example/storage/bucket/CreateBucketWithObjectRetention.java/HEAD/storage_create_bucket_with_object_retention" data-code-snippet="true" data-github-includecode-link="https://github.com/googleapis/java-storage/blob/HEAD/samples/snippets/src/main/java/com/example/storage/bucket/CreateBucketWithObjectRetention.java" feedback-context="{&#34;language&#34;: &#34;java&#34;, &#34;region_tag&#34;: &#34;storage-set-bucket-object-retentions&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/googleapis/java-storage/blob/HEAD/samples/snippets/src/main/java/com/example/storage/bucket/CreateBucketWithObjectRetention.java&#34;}" feedback-product="1634365" feedback-bucket="storage" language="java" data-github-path="googleapis/java-storage/samples/snippets/src/main/java/com/example/storage/bucket/CreateBucketWithObjectRetention.java" data-git-revision="HEAD" data-region-tag="storage_create_bucket_with_object_retention" dir="ltr" is-upgraded syntax="Java"><code translate="no" dir="ltr"> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.Bucket</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.BucketInfo</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.Storage</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.StorageOptions</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">class</span> <span class="devsite-syntax-nc">CreateBucketWithObjectRetention</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">void</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">createBucketWithObjectRetention</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucketName</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The ID of your GCP project</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// String projectId = "your-project-id";</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The ID to give your GCS bucket</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// String bucketName = "your-unique-bucket-name";</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Storage</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">StorageOptions</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">setProjectId</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">getService</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Bucket</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">create</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">BucketInfo</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">of</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucketName</span><span class="devsite-syntax-p">),</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">BucketTargetOption</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">enableObjectRetention</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Created bucket "</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getName</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">" with object retention enabled setting: "</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getObjectRetention</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">getMode</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">toString</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span> </code></pre></devsite-code> </div> </section> <section> <h3 id="storage-set-bucket-object-retentions-nodejs" track-metadata-position="storage-set-bucket-object-retentions" track-metadata-region-tag="storage-set-bucket-object-retentions" data-text="Node.js" tabindex="-1"><span class="notranslate">Node.js</span></h3> <p> For more information, see the <a href="https://cloud.google.com/nodejs/docs/reference/storage/latest" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="nodejs" track-metadata-snippet-file-url="https://github.com/googleapis/nodejs-storage/blob//samples/createBucketWithObjectRetention.js" track-metadata-region-tag="storage-set-bucket-object-retentions">Cloud Storage <span class="notranslate">Node.js</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="googleapis/nodejs-storage/samples/createBucketWithObjectRetention.js/HEAD/storage_create_bucket_with_object_retention" data-code-snippet="true" data-github-includecode-link="https://github.com/googleapis/nodejs-storage/blob/HEAD/samples/createBucketWithObjectRetention.js" feedback-context="{&#34;language&#34;: &#34;nodejs&#34;, &#34;region_tag&#34;: &#34;storage-set-bucket-object-retentions&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/googleapis/nodejs-storage/blob/HEAD/samples/createBucketWithObjectRetention.js&#34;}" feedback-product="1634365" feedback-bucket="storage" language="nodejs" data-github-path="googleapis/nodejs-storage/samples/createBucketWithObjectRetention.js" data-git-revision="HEAD" data-region-tag="storage_create_bucket_with_object_retention" dir="ltr" is-upgraded syntax="JavaScript"><code translate="no" dir="ltr"><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * TODO(developer): Uncomment the following lines before running the sample.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-c1">// The ID of your GCS bucket</span> <span class="devsite-syntax-c1">// const bucketName = 'your-unique-bucket-name';</span> <span class="devsite-syntax-c1">// Imports the Google Cloud client library</span> <span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">Storage</span><span class="devsite-syntax-p">}</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">require</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'@google-cloud/storage'</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-c1">// Creates a client</span> <span class="devsite-syntax-c1">// The bucket in the sample below will be created in the project associated with this client.</span> <span class="devsite-syntax-c1">// For more information, please see https://cloud.google.com/docs/authentication/production or https://googleapis.dev/nodejs/storage/latest/Storage.html</span> <span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">storage</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Storage</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-k">async</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">function</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">createBucketWithObjectRetention</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-nx">bucket</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">createBucket</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">bucketName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">enableObjectRetention</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sb">`Created '</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">' with object retention enabled setting: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">objectRetention</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">mode</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-p">}</span> <span class="devsite-syntax-nx">createBucketWithObjectRetention</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-k">catch</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">error</span><span class="devsite-syntax-p">);</span></code></pre></devsite-code> </div> </section> <section> <h3 id="storage-set-bucket-object-retentions-php" track-metadata-position="storage-set-bucket-object-retentions" track-metadata-region-tag="storage-set-bucket-object-retentions" data-text="PHP" tabindex="-1"><span class="notranslate">PHP</span></h3> <p> For more information, see the <a href="https://googleapis.github.io/google-cloud-php/#/docs/google-cloud/latest/storage/storageclient" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="php" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/php-docs-samples/blob//storage/src/create_bucket_with_object_retention.php" track-metadata-region-tag="storage-set-bucket-object-retentions">Cloud Storage <span class="notranslate">PHP</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/php-docs-samples/storage/src/create_bucket_with_object_retention.php/HEAD/storage_create_bucket_with_object_retention" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/php-docs-samples/blob/HEAD/storage/src/create_bucket_with_object_retention.php" feedback-context="{&#34;language&#34;: &#34;php&#34;, &#34;region_tag&#34;: &#34;storage-set-bucket-object-retentions&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/php-docs-samples/blob/HEAD/storage/src/create_bucket_with_object_retention.php&#34;}" feedback-product="1634365" feedback-bucket="storage" language="php" data-github-path="GoogleCloudPlatform/php-docs-samples/storage/src/create_bucket_with_object_retention.php" data-git-revision="HEAD" data-region-tag="storage_create_bucket_with_object_retention" dir="ltr" is-upgraded syntax="PHP"><code translate="no" dir="ltr"><span class="devsite-syntax-x">use Google\Cloud\Storage\StorageClient;</span> <span class="devsite-syntax-x">/**</span> <span class="devsite-syntax-x"> * Create a Cloud Storage bucket with the object retention enabled.</span> <span class="devsite-syntax-x"> *</span> <span class="devsite-syntax-x"> * @param string $bucketName The name of your Cloud Storage bucket.</span> <span class="devsite-syntax-x"> * (e.g. 'my-bucket')</span> <span class="devsite-syntax-x"> */</span> <span class="devsite-syntax-x">function create_bucket_with_object_retention(string $bucketName): void</span> <span class="devsite-syntax-x">{</span> <span class="devsite-syntax-x"> $storage = new StorageClient();</span> <span class="devsite-syntax-x"> $bucket = $storage-&gt;createBucket($bucketName, [</span> <span class="devsite-syntax-x"> 'enableObjectRetention' =&gt; true</span> <span class="devsite-syntax-x"> ]);</span> <span class="devsite-syntax-x"> printf(</span> <span class="devsite-syntax-x"> 'Created bucket %s with object retention enabled setting: %s' . PHP_EOL,</span> <span class="devsite-syntax-x"> $bucketName,</span> <span class="devsite-syntax-x"> $bucket-&gt;info()['objectRetention']['mode']</span> <span class="devsite-syntax-x"> );</span> <span class="devsite-syntax-x">}</span></code></pre></devsite-code> </div> </section> <section> <h3 id="storage-set-bucket-object-retentions-python" track-metadata-position="storage-set-bucket-object-retentions" track-metadata-region-tag="storage-set-bucket-object-retentions" data-text="Python" tabindex="-1"><span class="notranslate">Python</span></h3> <p> For more information, see the <a href="https://cloud.google.com/python/docs/reference/storage/latest" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="python" track-metadata-snippet-file-url="https://github.com/googleapis/python-storage/blob//samples/snippets/storage_create_bucket_object_retention.py" track-metadata-region-tag="storage-set-bucket-object-retentions">Cloud Storage <span class="notranslate">Python</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="googleapis/python-storage/samples/snippets/storage_create_bucket_object_retention.py/HEAD/storage_create_bucket_with_object_retention" data-code-snippet="true" data-github-includecode-link="https://github.com/googleapis/python-storage/blob/HEAD/samples/snippets/storage_create_bucket_object_retention.py" feedback-context="{&#34;language&#34;: &#34;python&#34;, &#34;region_tag&#34;: &#34;storage-set-bucket-object-retentions&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/googleapis/python-storage/blob/HEAD/samples/snippets/storage_create_bucket_object_retention.py&#34;}" feedback-product="1634365" feedback-bucket="storage" language="python" data-github-path="googleapis/python-storage/samples/snippets/storage_create_bucket_object_retention.py" data-git-revision="HEAD" data-region-tag="storage_create_bucket_with_object_retention" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"><span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">google.cloud</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">storage</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">create_bucket_object_retention</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-p">):</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""Creates a bucket with object retention enabled."""</span> <span class="devsite-syntax-c1"># The ID of your GCS bucket</span> <span class="devsite-syntax-c1"># bucket_name = "your-bucket-name"</span> <span class="devsite-syntax-n">storage_client</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">storage</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Client</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">bucket</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">storage_client</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">create_bucket</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">enable_object_retention</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Created bucket </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2"> with object retention enabled setting: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">object_retention_mode</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> </code></pre></devsite-code> </div> </section> </div> </section> </p></section> <section><h3 id="rest-apis" data-text="REST APIs" tabindex="-1">REST APIs</h3><div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="json-api" data-text="JSON API" tabindex="-1">JSON API</h3><p><a href="/storage/docs/json_api/v1/buckets/insert">Create a bucket</a> as you normally would, and include the query parameter <code translate="no" dir="ltr">enableObjectRetention=true</code> as part of the request.</p></section> <section><h3 id="xml-api" data-text="XML API" tabindex="-1">XML API</h3><p><a href="/storage/docs/xml-api/put-bucket-create">Create a bucket</a> as you normally would, and include the header <code translate="no" dir="ltr">x-goog-bucket-object-lock-enabled: True</code> as part of the request.</p></section> </div></section> </div> <h2 id="view-bucket-status" data-text="View a bucket's object retention status" tabindex="-1">View a bucket's object retention status</h2> <p>To see if retention configurations can be set for objects in a bucket:</p> <div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="console_1" data-text="Console" tabindex="-1">Console</h3><ol> <li>In the Google Cloud console, go to the Cloud Storage <b>Buckets</b> page.<br> <p><a class="button button-primary" href="https://console.cloud.google.com/storage/browser" target="console">Go to Buckets</a></p></li> <li><p>Click the name of the bucket whose status you want to check.</p></li> <li><p>Click the <strong>Protection</strong> tab.</p></li> <li><p>The bucket&#39;s object retention status is displayed in the <strong>Object retention</strong> section.</p></li> </ol></section> <section><h3 id="command-line_1" data-text="Command line" tabindex="-1">Command line</h3><p>Use the <a href="/sdk/gcloud/reference/storage/buckets/describe"><code translate="no" dir="ltr">gcloud storage buckets describe</code></a> command with the <code translate="no" dir="ltr">--format</code> flag:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded>gcloud storage buckets describe gs://<var translate="no">BUCKET_NAME</var> --format="default(per_object_retention)"</pre></devsite-code> <p>Where <code translate="no" dir="ltr"><var translate="no">BUCKET_NAME</var></code> is the name of the bucket whose retention policy you want to view. For example, <code translate="no" dir="ltr">my-bucket</code>.</p> <p>If successful and a retention policy exists for the bucket, the response is similar to the following:</p> <div></div><devsite-code><pre class="readonly" translate="no" dir="ltr" is-upgraded> per_object_retention: mode: Enabled </pre></devsite-code> <p>If successful and a retention policy does not exist for the bucket, the response is similar to the following:</p> <div></div><devsite-code><pre class="readonly" translate="no" dir="ltr" is-upgraded>null</pre></devsite-code></section> <section><h3 id="client-libraries_1" data-text="Client libraries" tabindex="-1">Client libraries</h3><p> <section> <div id="storage-get-bucket-object-retention-code-sample" class="ds-selector-tabs" data-ds-scope="code-sample"> <section> <h3 id="storage-get-bucket-object-retention-cpp" track-metadata-position="storage-get-bucket-object-retention" track-metadata-region-tag="storage-get-bucket-object-retention" data-text="C++" tabindex="-1"><span class="notranslate">C++</span></h3> <p> For more information, see the <a href="/cpp/docs/reference/storage/latest" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="cpp" track-metadata-snippet-file-url="https://github.com/googleapis/google-cloud-cpp/blob//google/cloud/storage/examples/storage_bucket_samples.cc" track-metadata-region-tag="storage-get-bucket-object-retention">Cloud Storage <span class="notranslate">C++</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> To view a bucket's object retention configuration, follow the instructions for displaying a bucket's metadata and look for the object retention field in the response. <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="googleapis/google-cloud-cpp/google/cloud/storage/examples/storage_bucket_samples.cc/HEAD/storage_get_bucket_metadata" data-code-snippet="true" data-github-includecode-link="https://github.com/googleapis/google-cloud-cpp/blob/HEAD/google/cloud/storage/examples/storage_bucket_samples.cc" feedback-context="{&#34;language&#34;: &#34;cpp&#34;, &#34;region_tag&#34;: &#34;storage-get-bucket-object-retention&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/googleapis/google-cloud-cpp/blob/HEAD/google/cloud/storage/examples/storage_bucket_samples.cc&#34;}" feedback-product="1634365" feedback-bucket="storage" language="cpp" data-github-path="googleapis/google-cloud-cpp/google/cloud/storage/examples/storage_bucket_samples.cc" data-git-revision="HEAD" data-region-tag="storage_get_bucket_metadata" dir="ltr" is-upgraded syntax="C++"><code translate="no" dir="ltr"><span class="devsite-syntax-k">namespace</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">gcs</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-nn">google</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-nn">cloud</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-nn">storage</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">google</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">cloud</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">StatusOr</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-p">[](</span><span class="devsite-syntax-n">gcs</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">Client</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">client</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">const</span>&amp;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">StatusOr&lt;gcs</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">BucketMetadata</span>&gt;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket_metadata</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">client</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">GetBucketMetadata</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-o">!</span><span class="devsite-syntax-n">bucket_metadata</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">move</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket_metadata</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-n">status</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">cout</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-s">"The metadata for bucket "</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-n">bucket_metadata</span><span class="devsite-syntax-o">-</span>&gt;<span class="devsite-syntax-n">name</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-s">" is "</span> <span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-n">bucket_metadata</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-s">"</span><span class="devsite-syntax-se">\n</span><span class="devsite-syntax-s">"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-p">}</span></code></pre></devsite-code> </div> </section> <section> <h3 id="storage-get-bucket-object-retention-csharp" track-metadata-position="storage-get-bucket-object-retention" track-metadata-region-tag="storage-get-bucket-object-retention" data-text="C#" tabindex="-1"><span class="notranslate">C#</span></h3> <p> For more information, see the <a href="https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Storage.V1/latest" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="csharp" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob//storage/api/Storage.Samples/GetBucketMetadata.cs" track-metadata-region-tag="storage-get-bucket-object-retention">Cloud Storage <span class="notranslate">C#</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> To view a bucket's object retention configuration, follow the instructions for displaying a bucket's metadata and look for the object retention field in the response. <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/dotnet-docs-samples/storage/api/Storage.Samples/GetBucketMetadata.cs/HEAD/storage_get_bucket_metadata" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob/HEAD/storage/api/Storage.Samples/GetBucketMetadata.cs" feedback-context="{&#34;language&#34;: &#34;csharp&#34;, &#34;region_tag&#34;: &#34;storage-get-bucket-object-retention&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob/HEAD/storage/api/Storage.Samples/GetBucketMetadata.cs&#34;}" feedback-product="1634365" feedback-bucket="storage" language="csharp" data-github-path="GoogleCloudPlatform/dotnet-docs-samples/storage/api/Storage.Samples/GetBucketMetadata.cs" data-git-revision="HEAD" data-region-tag="storage_get_bucket_metadata" dir="ltr" is-upgraded syntax="C#"><code translate="no" dir="ltr"> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">Google.Apis.Storage.v1.Data</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">Google.Cloud.Storage.V1</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">System</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">class</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nc">GetBucketMetadataSample</span> <span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Bucket</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">GetBucketMetadata</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucketName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"your-unique-bucket-name"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">var</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">StorageClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Create</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">var</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">GetBucket</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucketName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">GetBucketOptions</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Projection</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Projection</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Full</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Bucket:\t{bucket.Name}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Acl:\t{bucket.Acl}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Billing:\t{bucket.Billing}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Cors:\t{bucket.Cors}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"DefaultEventBasedHold:\t{bucket.DefaultEventBasedHold}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"DefaultObjectAcl:\t{bucket.DefaultObjectAcl}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Encryption:\t{bucket.Encryption}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Encryption</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">null</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"KmsKeyName:\t{bucket.Encryption.DefaultKmsKeyName}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Id:\t{bucket.Id}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Kind:\t{bucket.Kind}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Lifecycle:\t{bucket.Lifecycle}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Location:\t{bucket.Location}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"LocationType:\t{bucket.LocationType}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Logging:\t{bucket.Logging}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Metageneration:\t{bucket.Metageneration}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"ObjectRetention:\t{bucket.ObjectRetention}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Owner:\t{bucket.Owner}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"ProjectNumber:\t{bucket.ProjectNumber}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"RetentionPolicy:\t{bucket.RetentionPolicy}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"SelfLink:\t{bucket.SelfLink}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"StorageClass:\t{bucket.StorageClass}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"TimeCreated:\t{bucket.TimeCreated}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Updated:\t{bucket.Updated}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Versioning:\t{bucket.Versioning}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Website:\t{bucket.Website}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"TurboReplication:\t{bucket.Rpo}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Labels</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">null</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Labels:"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">foreach</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kt">var</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">label</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">in</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Labels</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"{label.Key}:\t{label.Value}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span></code></pre></devsite-code> </div> </section> <section> <h3 id="storage-get-bucket-object-retention-java" track-metadata-position="storage-get-bucket-object-retention" track-metadata-region-tag="storage-get-bucket-object-retention" data-text="Java" tabindex="-1"><span class="notranslate">Java</span></h3> <p> For more information, see the <a href="https://cloud.google.com/java/docs/reference/google-cloud-storage/latest/overview" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="java" track-metadata-snippet-file-url="https://github.com/googleapis/java-storage/blob//samples/snippets/src/main/java/com/example/storage/bucket/GetBucketMetadata.java" track-metadata-region-tag="storage-get-bucket-object-retention">Cloud Storage <span class="notranslate">Java</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> To view a bucket's object retention configuration, follow the instructions for displaying a bucket's metadata and look for the object retention field in the response. <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="googleapis/java-storage/samples/snippets/src/main/java/com/example/storage/bucket/GetBucketMetadata.java/HEAD/storage_get_bucket_metadata" data-code-snippet="true" data-github-includecode-link="https://github.com/googleapis/java-storage/blob/HEAD/samples/snippets/src/main/java/com/example/storage/bucket/GetBucketMetadata.java" feedback-context="{&#34;language&#34;: &#34;java&#34;, &#34;region_tag&#34;: &#34;storage-get-bucket-object-retention&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/googleapis/java-storage/blob/HEAD/samples/snippets/src/main/java/com/example/storage/bucket/GetBucketMetadata.java&#34;}" feedback-product="1634365" feedback-bucket="storage" language="java" data-github-path="googleapis/java-storage/samples/snippets/src/main/java/com/example/storage/bucket/GetBucketMetadata.java" data-git-revision="HEAD" data-region-tag="storage_get_bucket_metadata" dir="ltr" is-upgraded syntax="Java"><code translate="no" dir="ltr"> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.Bucket</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.BucketInfo</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.Storage</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.StorageOptions</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.Map</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">class</span> <span class="devsite-syntax-nc">GetBucketMetadata</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">void</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">getBucketMetadata</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucketName</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The ID of your GCP project</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// String projectId = "your-project-id";</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The ID of your GCS bucket</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// String bucketName = "your-unique-bucket-name";</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Storage</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">StorageOptions</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">setProjectId</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">getService</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Select all fields. Fields can be selected individually e.g. Storage.BucketField.NAME</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Bucket</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">get</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucketName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">BucketGetOption</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">fields</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">Storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">BucketField</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">values</span><span class="devsite-syntax-p">()));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Print bucket metadata</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"BucketName: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getName</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"DefaultEventBasedHold: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getDefaultEventBasedHold</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"DefaultKmsKeyName: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getDefaultKmsKeyName</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Id: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getGeneratedId</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"IndexPage: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getIndexPage</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Location: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getLocation</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"LocationType: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getLocationType</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Metageneration: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getMetageneration</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"NotFoundPage: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getNotFoundPage</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"RetentionEffectiveTime: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getRetentionEffectiveTime</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"RetentionPeriod: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getRetentionPeriod</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"RetentionPolicyIsLocked: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">retentionPolicyIsLocked</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"RequesterPays: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">requesterPays</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"SelfLink: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getSelfLink</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"StorageClass: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getStorageClass</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">name</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"TimeCreated: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getCreateTime</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"VersioningEnabled: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">versioningEnabled</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"ObjectRetention: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getObjectRetention</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getLabels</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">null</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"\n\n\nLabels:"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">for</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">Map</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">Entry&lt;String</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span>&gt;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">label</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getLabels</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">entrySet</span><span class="devsite-syntax-p">())</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">label</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getKey</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"="</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">label</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getValue</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getLifecycleRules</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">null</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"\n\n\nLifecycle Rules:"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">for</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">BucketInfo</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">LifecycleRule</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">rule</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getLifecycleRules</span><span class="devsite-syntax-p">())</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">rule</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span></code></pre></devsite-code> </div> </section> <section> <h3 id="storage-get-bucket-object-retention-nodejs" track-metadata-position="storage-get-bucket-object-retention" track-metadata-region-tag="storage-get-bucket-object-retention" data-text="Node.js" tabindex="-1"><span class="notranslate">Node.js</span></h3> <p> For more information, see the <a href="https://cloud.google.com/nodejs/docs/reference/storage/latest" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="nodejs" track-metadata-snippet-file-url="https://github.com/googleapis/nodejs-storage/blob//samples/bucketMetadata.js" track-metadata-region-tag="storage-get-bucket-object-retention">Cloud Storage <span class="notranslate">Node.js</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> To view a bucket's object retention configuration, follow the instructions for displaying a bucket's metadata and look for the object retention field in the response. <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="googleapis/nodejs-storage/samples/bucketMetadata.js/HEAD/storage_get_bucket_metadata" data-code-snippet="true" data-github-includecode-link="https://github.com/googleapis/nodejs-storage/blob/HEAD/samples/bucketMetadata.js" feedback-context="{&#34;language&#34;: &#34;nodejs&#34;, &#34;region_tag&#34;: &#34;storage-get-bucket-object-retention&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/googleapis/nodejs-storage/blob/HEAD/samples/bucketMetadata.js&#34;}" feedback-product="1634365" feedback-bucket="storage" language="nodejs" data-github-path="googleapis/nodejs-storage/samples/bucketMetadata.js" data-git-revision="HEAD" data-region-tag="storage_get_bucket_metadata" dir="ltr" is-upgraded syntax="JavaScript"><code translate="no" dir="ltr"><span class="devsite-syntax-c1">// Imports the Google Cloud client library</span> <span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">Storage</span><span class="devsite-syntax-p">}</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">require</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'@google-cloud/storage'</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-c1">// Creates a client</span> <span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">storage</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Storage</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-k">async</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">function</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">getBucketMetadata</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * TODO(developer): Uncomment the following lines before running the sample.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The ID of your GCS bucket</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// const bucketName = 'your-unique-bucket-name';</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Get Bucket Metadata</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">bucket</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">bucketName</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-nx">getMetadata</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nb">JSON</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">stringify</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">null</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">2</span><span class="devsite-syntax-p">));</span> <span class="devsite-syntax-p">}</span></code></pre></devsite-code> </div> </section> <section> <h3 id="storage-get-bucket-object-retention-php" track-metadata-position="storage-get-bucket-object-retention" track-metadata-region-tag="storage-get-bucket-object-retention" data-text="PHP" tabindex="-1"><span class="notranslate">PHP</span></h3> <p> For more information, see the <a href="https://googleapis.github.io/google-cloud-php/#/docs/google-cloud/latest/storage/storageclient" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="php" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/php-docs-samples/blob//storage/src/get_bucket_metadata.php" track-metadata-region-tag="storage-get-bucket-object-retention">Cloud Storage <span class="notranslate">PHP</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> To view a bucket's object retention configuration, follow the instructions for displaying a bucket's metadata and look for the object retention field in the response. <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/php-docs-samples/storage/src/get_bucket_metadata.php/HEAD/storage_get_bucket_metadata" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/php-docs-samples/blob/HEAD/storage/src/get_bucket_metadata.php" feedback-context="{&#34;language&#34;: &#34;php&#34;, &#34;region_tag&#34;: &#34;storage-get-bucket-object-retention&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/php-docs-samples/blob/HEAD/storage/src/get_bucket_metadata.php&#34;}" feedback-product="1634365" feedback-bucket="storage" language="php" data-github-path="GoogleCloudPlatform/php-docs-samples/storage/src/get_bucket_metadata.php" data-git-revision="HEAD" data-region-tag="storage_get_bucket_metadata" dir="ltr" is-upgraded syntax="PHP"><code translate="no" dir="ltr"><span class="devsite-syntax-x">use Google\Cloud\Storage\StorageClient;</span> <span class="devsite-syntax-x">/**</span> <span class="devsite-syntax-x"> * Get bucket metadata.</span> <span class="devsite-syntax-x"> *</span> <span class="devsite-syntax-x"> * @param string $bucketName The name of your Cloud Storage bucket.</span> <span class="devsite-syntax-x"> * (e.g. 'my-bucket')</span> <span class="devsite-syntax-x"> */</span> <span class="devsite-syntax-x">function get_bucket_metadata(string $bucketName): void</span> <span class="devsite-syntax-x">{</span> <span class="devsite-syntax-x"> $storage = new StorageClient();</span> <span class="devsite-syntax-x"> $bucket = $storage-&gt;bucket($bucketName);</span> <span class="devsite-syntax-x"> $info = $bucket-&gt;info();</span> <span class="devsite-syntax-x"> printf('Bucket Metadata: %s' . PHP_EOL, print_r($info));</span> <span class="devsite-syntax-x">}</span></code></pre></devsite-code> </div> </section> <section> <h3 id="storage-get-bucket-object-retention-python" track-metadata-position="storage-get-bucket-object-retention" track-metadata-region-tag="storage-get-bucket-object-retention" data-text="Python" tabindex="-1"><span class="notranslate">Python</span></h3> <p> For more information, see the <a href="https://cloud.google.com/python/docs/reference/storage/latest" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="python" track-metadata-snippet-file-url="https://github.com/googleapis/python-storage/blob//samples/snippets/storage_get_bucket_metadata.py" track-metadata-region-tag="storage-get-bucket-object-retention">Cloud Storage <span class="notranslate">Python</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> To view a bucket's object retention configuration, follow the instructions for displaying a bucket's metadata and look for the object retention field in the response. <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="googleapis/python-storage/samples/snippets/storage_get_bucket_metadata.py/HEAD/storage_get_bucket_metadata" data-code-snippet="true" data-github-includecode-link="https://github.com/googleapis/python-storage/blob/HEAD/samples/snippets/storage_get_bucket_metadata.py" feedback-context="{&#34;language&#34;: &#34;python&#34;, &#34;region_tag&#34;: &#34;storage-get-bucket-object-retention&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/googleapis/python-storage/blob/HEAD/samples/snippets/storage_get_bucket_metadata.py&#34;}" feedback-product="1634365" feedback-bucket="storage" language="python" data-github-path="googleapis/python-storage/samples/snippets/storage_get_bucket_metadata.py" data-git-revision="HEAD" data-region-tag="storage_get_bucket_metadata" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"> <span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">google.cloud</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">storage</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">bucket_metadata</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-p">):</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""Prints out a bucket's metadata."""</span> <span class="devsite-syntax-c1"># bucket_name = 'your-bucket-name'</span> <span class="devsite-syntax-n">storage_client</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">storage</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Client</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">bucket</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">storage_client</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">get_bucket</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"ID: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">id</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Name: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Storage Class: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">storage_class</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Location: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">location</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Location Type: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">location_type</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Cors: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">cors</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Default Event Based Hold: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">default_event_based_hold</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Default KMS Key Name: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">default_kms_key_name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Metageneration: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">metageneration</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Public Access Prevention: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">iam_configuration</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">public_access_prevention</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Retention Effective Time: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">retention_policy_effective_time</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Retention Period: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">retention_period</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Retention Policy Locked: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">retention_policy_locked</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Object Retention Mode: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">object_retention_mode</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Requester Pays: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">requester_pays</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Self Link: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">self_link</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Time Created: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">time_created</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Versioning Enabled: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">versioning_enabled</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Labels: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">labels</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> </code></pre></devsite-code> </div> </section> </div> </section> </p></section> <section><h3 id="rest-apis_1" data-text="REST APIs" tabindex="-1">REST APIs</h3><div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="json-api_1" data-text="JSON API" tabindex="-1">JSON API</h3><ol> <li><p>Have gcloud CLI <a href="/sdk/docs/install">installed and initialized<a>, which lets you generate an access token for the <code translate="no" dir="ltr">Authorization</code> header.</p></li> <li><p>Use <a href="http://curl.haxx.se/" class="external"><code translate="no" dir="ltr">cURL</code></a> to call the JSON API with a <a href="/storage/docs/json_api/v1/buckets/get"><code translate="no" dir="ltr">GET</code> Bucket</a> request that includes the <code translate="no" dir="ltr">objectRetention</code> field:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded>curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://storage.googleapis.com/storage/v1/b/<var translate="no">BUCKET_NAME</var>?fields=objectRetention"</pre></devsite-code> <p>Where <code translate="no" dir="ltr"><var translate="no">BUCKET_NAME</var></code> is the name of the relevant bucket. For example, <code translate="no" dir="ltr">my-bucket</code>.</p></li> </ol></section> <section><h3 id="xml-api_1" data-text="XML API" tabindex="-1">XML API</h3><ol> <li><p>Have gcloud CLI <a href="/sdk/docs/install">installed and initialized<a>, which lets you generate an access token for the <code translate="no" dir="ltr">Authorization</code> header.</p></li> <li><p>Use <a href="http://curl.haxx.se/" class="external"><code translate="no" dir="ltr">cURL</code></a> to call the XML API with a <a href="/storage/docs/xml-api/get-bucket-metadata"><code translate="no" dir="ltr">GET</code> Bucket</a> request scoped to <code translate="no" dir="ltr">?object-lock</code>:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded>curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://storage.googleapis.com/<var translate="no">BUCKET_NAME</var>?object-lock"</pre></devsite-code> <p>Where <code translate="no" dir="ltr"><var translate="no">BUCKET_NAME</var></code> is the name of the relevant bucket. For example, <code translate="no" dir="ltr">my-bucket</code>.</p></li> </ol></section> </div></section> </div> <h2 id="set-object-config" data-text="Set an object's retention configuration" tabindex="-1">Set an object's retention configuration</h2> <aside class="caution"><strong>Caution:</strong><span> Setting the mode of a retention configuration to <code translate="no" dir="ltr">Locked</code> (<code translate="no" dir="ltr">COMPLIANCE</code> in the XML API) is an irreversible action. If you do so: <ul><li>You cannot remove the retention configuration from the object.</li> <li>You cannot decrease the retention time for the object.</li></ul></span></aside> <p>In order to set a retention configuration for an object, the object must be stored in a bucket for which <a href="#enable-retentions">object retentions are enabled</a>. To set a retention configuration for an object:</p> <div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="console_2" data-text="Console" tabindex="-1">Console</h3><ol> <li>In the Google Cloud console, go to the Cloud Storage <b>Buckets</b> page.<br> <p><a class="button button-primary" href="https://console.cloud.google.com/storage/browser" target="console">Go to Buckets</a></p></li> <li><p>In the list of buckets, click the name of the bucket that contains the object whose retention configuration you want to set or modify.</p> <p>The <strong>Bucket details</strong> page opens, with the <strong>Objects</strong> tab selected.</p></li> <li><p>Navigate to the object, which might be located in a folder.</p></li> <li><p>Click the name of the object.</p> <p>The <strong>Object details</strong> page opens, which displays object metadata.</p></li> <li><p>In the <strong>Protection</strong> section, click the <strong>Edit</strong> icon (<i class="material-icons" aria-label="Edit default storage class" aria-hidden="true" translate="no">edit</i>) associated with <strong>From object retention configuration</strong>.</p> <p>The <strong>Edit retention</strong> pane opens.</p></li> <li><p>In the <strong>Object retention configuration</strong> section, click <strong>Enabled</strong> or <strong>Disabled</strong>.</p> <ol> <li>If the retention configuration is enabled, select a date and time for the configuration in the <strong>Retain until time</strong> section, and click <strong>Unlocked</strong> or <strong>Locked</strong> in the <strong>Retention mode</strong> section.</li> </ol></li> <li><p>Click <strong>Confirm</strong>.</p></li> </ol> <aside class="note"><strong>Note:</strong><span> You can also set a retention configuration for an object at the time the object is uploaded to the bucket. If the bucket you&#39;re uploading the object to has the object retention feature enabled, a panel appears during the upload that lets you specify a retention configuration for the object.</span></aside></section> <section><h3 id="command-line_2" data-text="Command line" tabindex="-1">Command line</h3><p>Use the <a href="/sdk/gcloud/reference/storage/objects/update"><code translate="no" dir="ltr">gcloud storage objects update</code></a> command with the appropriate flags. To add or modify a retention configuration, use the following command. Note that you must additionally include the <code translate="no" dir="ltr">--override-unlocked-retention</code> flag if you are modifying an existing configuration in a way that locks it or shortens its retain-until time:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded>gcloud storage objects update gs://<var translate="no">BUCKET_NAME</var>/<var translate="no">OBJECT_NAME</var> --retain-until=<var translate="no">DATETIME</var> --retention-mode=<var translate="no">STATE</var></pre></devsite-code> <p>Where:</p> <ul> <li><p><code translate="no" dir="ltr"><var translate="no">BUCKET_NAME</var></code> is the name of the relevant bucket. For example, <code translate="no" dir="ltr">my-bucket</code>.</p></li> <li><p><code translate="no" dir="ltr"><var translate="no">OBJECT_NAME</var></code> is the name of the relevant object. For example, <code translate="no" dir="ltr">kitten.png</code>.</p></li> <li><p><code translate="no" dir="ltr"><var translate="no">DATETIME</var></code> is the earliest date and time that the object can be deleted. For example, <code translate="no" dir="ltr">2028-02-15T05:30:00Z</code>.</p></li> <li><p><code translate="no" dir="ltr"><var translate="no">STATE</var></code> is either <code translate="no" dir="ltr">Locked</code> or <code translate="no" dir="ltr">Unlocked</code>.</p></li> </ul> <p>If successful, the response looks similar to the following example:</p> <div></div><devsite-code><pre translate="no" dir="ltr" is-upgraded>Updating gs://my-bucket/kitten.png... Completed 1 </pre></devsite-code> <p>To remove a retention configuration from an object, use the following command:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded>gcloud storage objects update gs://<var translate="no">BUCKET_NAME</var>/<var translate="no">OBJECT_NAME</var> --clear-retention --override-unlocked-retention</pre></devsite-code> <p>Where:</p> <ul> <li><p><code translate="no" dir="ltr"><var translate="no">BUCKET_NAME</var></code> is the name of the relevant bucket. For example, <code translate="no" dir="ltr">my-bucket</code>.</p></li> <li><p><code translate="no" dir="ltr"><var translate="no">OBJECT_NAME</var></code> is the name of the relevant object. For example, <code translate="no" dir="ltr">kitten.png</code>.</p></li> </ul> <aside class="note"><strong>Note:</strong><span> You can also set a retention configuration for an object at the time the object is written to the bucket. See command documentation, such as <a href="/sdk/gcloud/reference/storage/cp"><code translate="no" dir="ltr">gcloud storage cp</code></a> for more information.</span></aside></section> <section><h3 id="client-libraries_2" data-text="Client libraries" tabindex="-1">Client libraries</h3><p> <section> <div id="storage-set-object-retention-policy-code-sample" class="ds-selector-tabs" data-ds-scope="code-sample"> <section> <h3 id="storage-set-object-retention-policy-cpp" track-metadata-position="storage-set-object-retention-policy" track-metadata-region-tag="storage-set-object-retention-policy" data-text="C++" tabindex="-1"><span class="notranslate">C++</span></h3> <p> For more information, see the <a href="/cpp/docs/reference/storage/latest" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="cpp" track-metadata-snippet-file-url="https://github.com/googleapis/google-cloud-cpp/blob//google/cloud/storage/examples/storage_object_retention_samples.cc" track-metadata-region-tag="storage-set-object-retention-policy">Cloud Storage <span class="notranslate">C++</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="googleapis/google-cloud-cpp/google/cloud/storage/examples/storage_object_retention_samples.cc/HEAD/storage_set_object_retention_policy" data-code-snippet="true" data-github-includecode-link="https://github.com/googleapis/google-cloud-cpp/blob/HEAD/google/cloud/storage/examples/storage_object_retention_samples.cc" feedback-context="{&#34;language&#34;: &#34;cpp&#34;, &#34;region_tag&#34;: &#34;storage-set-object-retention-policy&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/googleapis/google-cloud-cpp/blob/HEAD/google/cloud/storage/examples/storage_object_retention_samples.cc&#34;}" feedback-product="1634365" feedback-bucket="storage" language="cpp" data-github-path="googleapis/google-cloud-cpp/google/cloud/storage/examples/storage_object_retention_samples.cc" data-git-revision="HEAD" data-region-tag="storage_set_object_retention_policy" dir="ltr" is-upgraded syntax="C++"><code translate="no" dir="ltr"><span class="devsite-syntax-k">namespace</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">gcs</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-nn">google</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-nn">cloud</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-nn">storage</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">google</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">cloud</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">StatusOr</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-p">[](</span><span class="devsite-syntax-n">gcs</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">Client</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">client</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">const</span>&amp;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">const</span>&amp;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">object_name</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">auto</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">original</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">client</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">GetObjectMetadata</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">object_name</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-o">!</span><span class="devsite-syntax-n">original</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">move</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">original</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-n">status</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">auto</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">until</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">chrono</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">system_clock</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">now</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">chrono</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">hours</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">24</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">auto</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">updated</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">client</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">PatchObject</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">object_name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">gcs</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">ObjectMetadataPatchBuilder</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-n">SetRetention</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">gcs</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">ObjectRetention</span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-n">gcs</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">ObjectRetentionUnlocked</span><span class="devsite-syntax-p">(),</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">until</span><span class="devsite-syntax-p">}),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">gcs</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">OverrideUnlockedRetention</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nb">true</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">gcs</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">IfMetagenerationMatch</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">original</span><span class="devsite-syntax-o">-</span>&gt;<span class="devsite-syntax-n">metageneration</span><span class="devsite-syntax-p">()));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-o">!</span><span class="devsite-syntax-n">updated</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">move</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">updated</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-n">status</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">cout</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-s">"Successfully updated object retention configuration: "</span> <span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-n">updated</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-s">"</span><span class="devsite-syntax-se">\n</span><span class="devsite-syntax-s">"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-p">}</span></code></pre></devsite-code> </div> </section> <section> <h3 id="storage-set-object-retention-policy-csharp" track-metadata-position="storage-set-object-retention-policy" track-metadata-region-tag="storage-set-object-retention-policy" data-text="C#" tabindex="-1"><span class="notranslate">C#</span></h3> <p> For more information, see the <a href="https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Storage.V1/latest" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="csharp" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob//storage/api/Storage.Samples/SetObjectRetentionPolicy.cs" track-metadata-region-tag="storage-set-object-retention-policy">Cloud Storage <span class="notranslate">C#</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/dotnet-docs-samples/storage/api/Storage.Samples/SetObjectRetentionPolicy.cs/HEAD/storage_set_object_retention_policy" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob/HEAD/storage/api/Storage.Samples/SetObjectRetentionPolicy.cs" feedback-context="{&#34;language&#34;: &#34;csharp&#34;, &#34;region_tag&#34;: &#34;storage-set-object-retention-policy&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob/HEAD/storage/api/Storage.Samples/SetObjectRetentionPolicy.cs&#34;}" feedback-product="1634365" feedback-bucket="storage" language="csharp" data-github-path="GoogleCloudPlatform/dotnet-docs-samples/storage/api/Storage.Samples/SetObjectRetentionPolicy.cs" data-git-revision="HEAD" data-region-tag="storage_set_object_retention_policy" dir="ltr" is-upgraded syntax="C#"><code translate="no" dir="ltr"> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">Google.Cloud.Storage.V1</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">System</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">Object</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Google</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Apis</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">v1</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Data</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Object</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">class</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nc">SetObjectRetentionPolicySample</span> <span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Google</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Apis</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">v1</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Data</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Object</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">SetObjectRetentionPolicy</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucketName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"your-unique-bucket-name"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// A bucket that has object retention enabled</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">objectName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"your-object-name"</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// An object that does not have a retention policy set</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">var</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">StorageClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Create</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">var</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">file</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">GetObject</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucketName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">objectName</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">file</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Retention</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Object</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">RetentionData</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Mode</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Unlocked"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">RetainUntilTimeDateTimeOffset</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">DateTimeOffset</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">UtcNow</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">AddDays</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-m">10</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">};</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">file</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">UpdateObject</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">file</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"The retention policy for object {objectName} was set to:"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Mode: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">file</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Retention</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Mode</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"RetainUntilTime: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">file</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Retention</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">RetainUntilTimeDateTimeOffset</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">ToString</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// To modify an existing policy on an Unlocked object, pass in the override parameter</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">file</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Retention</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Object</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">RetentionData</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Mode</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"Unlocked"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">RetainUntilTimeDateTimeOffset</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">DateTimeOffset</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">UtcNow</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">AddDays</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-m">9</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">};</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">file</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">UpdateObject</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">file</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">UpdateObjectOptions</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">OverrideUnlockedRetention</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">true</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"The retention policy for object {objectName} was updated to:"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Mode: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">file</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Retention</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Mode</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"RetainUntilTime: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">file</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Retention</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">RetainUntilTimeDateTimeOffset</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">ToString</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">file</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span></code></pre></devsite-code> </div> </section> <section> <h3 id="storage-set-object-retention-policy-java" track-metadata-position="storage-set-object-retention-policy" track-metadata-region-tag="storage-set-object-retention-policy" data-text="Java" tabindex="-1"><span class="notranslate">Java</span></h3> <p> For more information, see the <a href="https://cloud.google.com/java/docs/reference/google-cloud-storage/latest/overview" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="java" track-metadata-snippet-file-url="https://github.com/googleapis/java-storage/blob//samples/snippets/src/main/java/com/example/storage/object/SetObjectRetentionPolicy.java" track-metadata-region-tag="storage-set-object-retention-policy">Cloud Storage <span class="notranslate">Java</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="googleapis/java-storage/samples/snippets/src/main/java/com/example/storage/object/SetObjectRetentionPolicy.java/HEAD/storage_set_object_retention_policy" data-code-snippet="true" data-github-includecode-link="https://github.com/googleapis/java-storage/blob/HEAD/samples/snippets/src/main/java/com/example/storage/object/SetObjectRetentionPolicy.java" feedback-context="{&#34;language&#34;: &#34;java&#34;, &#34;region_tag&#34;: &#34;storage-set-object-retention-policy&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/googleapis/java-storage/blob/HEAD/samples/snippets/src/main/java/com/example/storage/object/SetObjectRetentionPolicy.java&#34;}" feedback-product="1634365" feedback-bucket="storage" language="java" data-github-path="googleapis/java-storage/samples/snippets/src/main/java/com/example/storage/object/SetObjectRetentionPolicy.java" data-git-revision="HEAD" data-region-tag="storage_set_object_retention_policy" dir="ltr" is-upgraded syntax="Java"><code translate="no" dir="ltr"> <span class="devsite-syntax-kn">import static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.time.OffsetDateTime.now</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.Blob</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.BlobId</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.BlobInfo.Retention</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.Storage</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.StorageException</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.StorageOptions</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">class</span> <span class="devsite-syntax-nc">SetObjectRetentionPolicy</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">void</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">setObjectRetentionPolicy</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucketName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">objectName</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">throws</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">StorageException</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The ID of your GCP project</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// String projectId = "your-project-id";</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The ID of your GCS bucket that has object retention enabled</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// String bucketName = "your-unique-bucket-name";</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The ID of your GCS object</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// String objectName = "your-object-name";</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Storage</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">StorageOptions</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">setProjectId</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">getService</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">BlobId</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blobId</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">BlobId</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">of</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucketName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">objectName</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Blob</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">get</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">blobId</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">==</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">null</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"The object "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">objectName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">" was not found in "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucketName</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Blob</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">updated</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">toBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setRetention</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Retention</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setMode</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">Retention</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">Mode</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">UNLOCKED</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setRetainUntilTime</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">now</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">plusDays</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">10</span><span class="devsite-syntax-p">))</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">())</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">update</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Retention policy for object "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">objectName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">" was set to:"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">updated</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getRetention</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">toString</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// To modify an existing policy on an Unlocked object, pass in the override parameter</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">toBuilder</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">setRetention</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">updated</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getRetention</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">toBuilder</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">setRetainUntilTime</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">now</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">plusDays</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-mi">9</span><span class="devsite-syntax-p">)).</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">())</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">update</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">Storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">BlobTargetOption</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">overrideUnlockedRetention</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Retention policy for object "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">objectName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">" was updated to:"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">get</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">blobId</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-na">getRetention</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">toString</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span> </code></pre></devsite-code> </div> </section> <section> <h3 id="storage-set-object-retention-policy-nodejs" track-metadata-position="storage-set-object-retention-policy" track-metadata-region-tag="storage-set-object-retention-policy" data-text="Node.js" tabindex="-1"><span class="notranslate">Node.js</span></h3> <p> For more information, see the <a href="https://cloud.google.com/nodejs/docs/reference/storage/latest" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="nodejs" track-metadata-snippet-file-url="https://github.com/googleapis/nodejs-storage/blob//samples/setObjectRetentionPolicy.js" track-metadata-region-tag="storage-set-object-retention-policy">Cloud Storage <span class="notranslate">Node.js</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="googleapis/nodejs-storage/samples/setObjectRetentionPolicy.js/HEAD/storage_set_object_retention_policy" data-code-snippet="true" data-github-includecode-link="https://github.com/googleapis/nodejs-storage/blob/HEAD/samples/setObjectRetentionPolicy.js" feedback-context="{&#34;language&#34;: &#34;nodejs&#34;, &#34;region_tag&#34;: &#34;storage-set-object-retention-policy&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/googleapis/nodejs-storage/blob/HEAD/samples/setObjectRetentionPolicy.js&#34;}" feedback-product="1634365" feedback-bucket="storage" language="nodejs" data-github-path="googleapis/nodejs-storage/samples/setObjectRetentionPolicy.js" data-git-revision="HEAD" data-region-tag="storage_set_object_retention_policy" dir="ltr" is-upgraded syntax="JavaScript"><code translate="no" dir="ltr"><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * TODO(developer): Uncomment the following lines before running the sample.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-c1">// The ID of your GCS bucket</span> <span class="devsite-syntax-c1">// const bucketName = 'your-unique-bucket-name';</span> <span class="devsite-syntax-c1">// The new ID for your GCS file</span> <span class="devsite-syntax-c1">// const destFileName = 'your-new-file-name';</span> <span class="devsite-syntax-c1">// The content to be uploaded in the GCS file</span> <span class="devsite-syntax-c1">// const contents = 'your file content';</span> <span class="devsite-syntax-c1">// Imports the Google Cloud client library</span> <span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">Storage</span><span class="devsite-syntax-p">}</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">require</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'@google-cloud/storage'</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-c1">// Creates a client</span> <span class="devsite-syntax-c1">// The bucket in the sample below will be created in the project associated with this client.</span> <span class="devsite-syntax-c1">// For more information, please see https://cloud.google.com/docs/authentication/production or https://googleapis.dev/nodejs/storage/latest/Storage.html</span> <span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">storage</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Storage</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-k">async</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">function</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">setObjectRetentionPolicy</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Get a reference to the bucket</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">myBucket</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">bucket</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">bucketName</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Create a reference to a file object</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">file</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">myBucket</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">file</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">destFileName</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Save the file data</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">file</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">save</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">contents</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Set the retention policy for the file</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">retentionDate</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">Date</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">retentionDate</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">setDate</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">retentionDate</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">getDate</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">10</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">file</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">setMetadata</span><span class="devsite-syntax-p">({</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">retention</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">mode</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'Unlocked'</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">retainUntilTime</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">retentionDate</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">toISOString</span><span class="devsite-syntax-p">(),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sb">`Retention policy for file </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">file</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb"> was set to: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">retention</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">mode</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// To modify an existing policy on an unlocked file object, pass in the override parameter</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">newRetentionDate</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">Date</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">retentionDate</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">setDate</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">retentionDate</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">getDate</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mf">9</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-nx">metdata</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">file</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">setMetadata</span><span class="devsite-syntax-p">({</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">retention</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">retainUntilTime</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">newRetentionDate</span><span class="devsite-syntax-p">},</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">overrideUnlockedRetention</span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sb">`Retention policy for file </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">file</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb"> was updated to: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">retention</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">retainUntilTime</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-p">}</span> <span class="devsite-syntax-nx">setObjectRetentionPolicy</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-k">catch</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">error</span><span class="devsite-syntax-p">);</span></code></pre></devsite-code> </div> </section> <section> <h3 id="storage-set-object-retention-policy-php" track-metadata-position="storage-set-object-retention-policy" track-metadata-region-tag="storage-set-object-retention-policy" data-text="PHP" tabindex="-1"><span class="notranslate">PHP</span></h3> <p> For more information, see the <a href="https://googleapis.github.io/google-cloud-php/#/docs/google-cloud/latest/storage/storageclient" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="php" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/php-docs-samples/blob//storage/src/set_object_retention_policy.php" track-metadata-region-tag="storage-set-object-retention-policy">Cloud Storage <span class="notranslate">PHP</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/php-docs-samples/storage/src/set_object_retention_policy.php/HEAD/storage_set_object_retention_policy" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/php-docs-samples/blob/HEAD/storage/src/set_object_retention_policy.php" feedback-context="{&#34;language&#34;: &#34;php&#34;, &#34;region_tag&#34;: &#34;storage-set-object-retention-policy&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/php-docs-samples/blob/HEAD/storage/src/set_object_retention_policy.php&#34;}" feedback-product="1634365" feedback-bucket="storage" language="php" data-github-path="GoogleCloudPlatform/php-docs-samples/storage/src/set_object_retention_policy.php" data-git-revision="HEAD" data-region-tag="storage_set_object_retention_policy" dir="ltr" is-upgraded syntax="PHP"><code translate="no" dir="ltr"><span class="devsite-syntax-x">use Google\Cloud\Storage\StorageClient;</span> <span class="devsite-syntax-x">/**</span> <span class="devsite-syntax-x"> * Sets a bucket's retention policy.</span> <span class="devsite-syntax-x"> *</span> <span class="devsite-syntax-x"> * @param string $bucketName The name of your Cloud Storage bucket.</span> <span class="devsite-syntax-x"> * (e.g. 'my-bucket')</span> <span class="devsite-syntax-x"> * @param string $objectName The name of your Cloud Storage object.</span> <span class="devsite-syntax-x"> * (e.g. 'my-object')</span> <span class="devsite-syntax-x"> */</span> <span class="devsite-syntax-x">function set_object_retention_policy(string $bucketName, string $objectName): void</span> <span class="devsite-syntax-x">{</span> <span class="devsite-syntax-x"> $storage = new StorageClient();</span> <span class="devsite-syntax-x"> $bucket = $storage-&gt;bucket($bucketName);</span> <span class="devsite-syntax-x"> $object = $bucket-&gt;object($objectName);</span> <span class="devsite-syntax-x"> $expires = (new \DateTime)-&gt;add(</span> <span class="devsite-syntax-x"> \DateInterval::createFromDateString('+10 days')</span> <span class="devsite-syntax-x"> );</span> <span class="devsite-syntax-x"> // To modify an existing policy on an Unlocked object, pass the override parameter</span> <span class="devsite-syntax-x"> $object-&gt;update([</span> <span class="devsite-syntax-x"> 'retention' =&gt; [</span> <span class="devsite-syntax-x"> 'mode' =&gt; 'Unlocked',</span> <span class="devsite-syntax-x"> 'retainUntilTime' =&gt; $expires-&gt;format(\DateTime::RFC3339)</span> <span class="devsite-syntax-x"> ],</span> <span class="devsite-syntax-x"> 'overrideUnlockedRetention' =&gt; true</span> <span class="devsite-syntax-x"> ]);</span> <span class="devsite-syntax-x"> printf(</span> <span class="devsite-syntax-x"> 'Retention policy for object %s was updated to: %s' . PHP_EOL,</span> <span class="devsite-syntax-x"> $objectName,</span> <span class="devsite-syntax-x"> $object-&gt;info()['retention']['retainUntilTime']</span> <span class="devsite-syntax-x"> );</span> <span class="devsite-syntax-x">}</span></code></pre></devsite-code> </div> </section> <section> <h3 id="storage-set-object-retention-policy-python" track-metadata-position="storage-set-object-retention-policy" track-metadata-region-tag="storage-set-object-retention-policy" data-text="Python" tabindex="-1"><span class="notranslate">Python</span></h3> <p> For more information, see the <a href="https://cloud.google.com/python/docs/reference/storage/latest" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="python" track-metadata-snippet-file-url="https://github.com/googleapis/python-storage/blob//samples/snippets/storage_set_object_retention_policy.py" track-metadata-region-tag="storage-set-object-retention-policy">Cloud Storage <span class="notranslate">Python</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="googleapis/python-storage/samples/snippets/storage_set_object_retention_policy.py/HEAD/storage_set_object_retention_policy" data-code-snippet="true" data-github-includecode-link="https://github.com/googleapis/python-storage/blob/HEAD/samples/snippets/storage_set_object_retention_policy.py" feedback-context="{&#34;language&#34;: &#34;python&#34;, &#34;region_tag&#34;: &#34;storage-set-object-retention-policy&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/googleapis/python-storage/blob/HEAD/samples/snippets/storage_set_object_retention_policy.py&#34;}" feedback-product="1634365" feedback-bucket="storage" language="python" data-github-path="googleapis/python-storage/samples/snippets/storage_set_object_retention_policy.py" data-git-revision="HEAD" data-region-tag="storage_set_object_retention_policy" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"><span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">google.cloud</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">storage</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">set_object_retention_policy</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">contents</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">destination_blob_name</span><span class="devsite-syntax-p">):</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""Set the object retention policy of a file."""</span> <span class="devsite-syntax-c1"># The ID of your GCS bucket</span> <span class="devsite-syntax-c1"># bucket_name = "your-bucket-name"</span> <span class="devsite-syntax-c1"># The contents to upload to the file</span> <span class="devsite-syntax-c1"># contents = "these are my contents"</span> <span class="devsite-syntax-c1"># The ID of your GCS object</span> <span class="devsite-syntax-c1"># destination_blob_name = "storage-object-name"</span> <span class="devsite-syntax-n">storage_client</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">storage</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Client</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">bucket</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">storage_client</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">blob</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">destination_blob_name</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">upload_from_string</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">contents</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Set the retention policy for the file.</span> <span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">retention</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">mode</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-s2">"Unlocked"</span> <span class="devsite-syntax-n">retention_date</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">datetime</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">datetime</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">now</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">datetime</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">timezone</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">utc</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">+</span> <span class="devsite-syntax-n">datetime</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">timedelta</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">days</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-mi">10</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">retention</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">retain_until_time</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">retention_date</span> <span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">patch</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Retention policy for file </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">destination_blob_name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2"> was set to: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">retention</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">mode</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">."</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># To modify an existing policy on an unlocked file object, pass in the override parameter.</span> <span class="devsite-syntax-n">new_retention_date</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">datetime</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">datetime</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">now</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">datetime</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">timezone</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">utc</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-o">+</span> <span class="devsite-syntax-n">datetime</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">timedelta</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">days</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-mi">9</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">retention</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">retain_until_time</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">new_retention_date</span> <span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">patch</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">override_unlocked_retention</span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-kc">True</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Retention policy for file </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">destination_blob_name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2"> was updated to: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">retention</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">retain_until_time</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">."</span> <span class="devsite-syntax-p">)</span> </code></pre></devsite-code> </div> </section> </div> </section> </p></section> <section><h3 id="rest-apis_2" data-text="REST APIs" tabindex="-1">REST APIs</h3><div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="json-api_2" data-text="JSON API" tabindex="-1">JSON API</h3><ol> <li><p>Have gcloud CLI <a href="/sdk/docs/install">installed and initialized<a>, which lets you generate an access token for the <code translate="no" dir="ltr">Authorization</code> header.</p></li> <li><p>Create a JSON file that contains the following information:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="JSON"><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"retention"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"mode"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><var translate="no"><span class="devsite-syntax-err">STATE</span></var><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nt">"retainUntilTime"</span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"<var translate="no">DATETIME</var>"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span></pre></devsite-code> <p>Where:</p> <ul> <li><p><code translate="no" dir="ltr"><var translate="no">STATE</var></code> is either <code translate="no" dir="ltr">Locked</code> or <code translate="no" dir="ltr">Unlocked</code>.</p></li> <li><p><code translate="no" dir="ltr"><var translate="no">DATETIME</var></code> is the earliest date and time that the object can be deleted. For example, <code translate="no" dir="ltr">2028-02-15T05:30:00Z</code>.</p></li> </ul></li> <li><p>Use <a href="http://curl.haxx.se/" class="external"><code translate="no" dir="ltr">cURL</code></a> to call the JSON API with a <a href="/storage/docs/json_api/v1/objects/patch"><code translate="no" dir="ltr">PATCH</code> Object</a> request:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded>curl -X PATCH --data-binary @<var translate="no">JSON_FILE_NAME</var> \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ "https://storage.googleapis.com/storage/v1/b/<var translate="no">BUCKET_NAME</var>/o/<var translate="no">OBJECT_NAME</var>?overrideUnlockedRetention=<var translate="no">BOOLEAN</var>"</pre></devsite-code> <p>Where:</p> <ul> <li><code translate="no" dir="ltr"><var translate="no">JSON_FILE_NAME</var></code> is the path for the file that you created in Step 2.</li> <li><code translate="no" dir="ltr"><var translate="no">BUCKET_NAME</var></code> is the name of the relevant bucket. For example, <code translate="no" dir="ltr">my-bucket</code>.</li> <li><code translate="no" dir="ltr"><var translate="no">OBJECT_NAME</var></code> is the URL-encoded name of the relevant object. For example, <code translate="no" dir="ltr">pets/kitten.png</code>, URL-encoded as <code translate="no" dir="ltr">pets%2Fkitten.png</code>.</li> <li><code translate="no" dir="ltr"><var translate="no">BOOLEAN</var></code> must be <code translate="no" dir="ltr">true</code> if the request shortens, removes, or locks an existing retention configuration. Otherwise, the <code translate="no" dir="ltr">overrideUnlockedRetention</code> parameter can be excluded from the request entirely.</li> </ul></li> </ol> <aside class="note"><strong>Note:</strong><span> You can also set a retention configuration for an object at the time the object is written to the bucket. See request documentation, such as <a href="/storage/docs/json_api/v1/objects/insert">Objects: Insert</a> for more information.</span></aside></section> <section><h3 id="xml-api_2" data-text="XML API" tabindex="-1">XML API</h3><ol> <li><p>Have gcloud CLI <a href="/sdk/docs/install">installed and initialized<a>, which lets you generate an access token for the <code translate="no" dir="ltr">Authorization</code> header.</p></li> <li><p>Create an XML file that contains the following information:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded>&lt;Retention&gt; &lt;Mode&gt; <var translate="no">STATE</var> &lt;/Mode&gt; &lt;RetainUntilDate&gt; <var translate="no">DATETIME</var> &lt;/RetainUntilDate&gt; &lt;/Retention&gt;</pre></devsite-code> <p>Where:</p> <ul> <li><p><code translate="no" dir="ltr"><var translate="no">STATE</var></code> is either <code translate="no" dir="ltr">GOVERNANCE</code> or <code translate="no" dir="ltr">COMPLIANCE</code>.</p></li> <li><p><code translate="no" dir="ltr"><var translate="no">DATETIME</var></code> is the earliest date and time that the object can be deleted. For example, <code translate="no" dir="ltr">2028-02-15T05:30:00Z</code>.</p></li> </ul></li> <li><p>Use <a href="http://curl.haxx.se/" class="external"><code translate="no" dir="ltr">cURL</code></a> to call the XML API with a <a href="/storage/docs/xml-api/put-object-retention"><code translate="no" dir="ltr">PUT</code> Object</a> request scoped to <code translate="no" dir="ltr">?retention</code>:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded>curl -X PUT --data-binary @<var translate="no">XML_FILE_NAME</var> \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "x-goog-bypass-governance-retention: <var translate="no">BOOLEAN</var>" \ "https://storage.googleapis.com/<var translate="no">BUCKET_NAME</var>/<var translate="no">OBJECT_NAME</var>?retention"</pre></devsite-code> <p>Where:</p> <ul> <li><code translate="no" dir="ltr"><var translate="no">XML_FILE_NAME</var></code> is the path for the XML file that you created in Step 2.</li> <li><code translate="no" dir="ltr"><var translate="no">BOOLEAN</var></code> must be <code translate="no" dir="ltr">true</code> if the request shortens, removes, or locks an existing retention configuration. Otherwise, the <code translate="no" dir="ltr">x-goog-bypass-governance-retention</code> header can be excluded from the request entirely.</li> <li><code translate="no" dir="ltr"><var translate="no">BUCKET_NAME</var></code> is the name of the relevant bucket. For example, <code translate="no" dir="ltr">my-bucket</code>.</li> <li><code translate="no" dir="ltr"><var translate="no">OBJECT_NAME</var></code> is the URL-encoded name of the relevant object. For example, <code translate="no" dir="ltr">pets/kitten.png</code>, URL-encoded as <code translate="no" dir="ltr">pets%2Fkitten.png</code>.</li> </ul></li> </ol> <aside class="note"><strong>Note:</strong><span> You can also set a retention configuration for an object at the time the object is written to the bucket. See request documentation, such as <a href="/storage/docs/xml-api/put-object-upload"><code translate="no" dir="ltr">PUT Object</code></a> for more information.</span></aside></section> </div></section> </div> <h2 id="view-object-config" data-text="View an object's retention configuration" tabindex="-1">View an object's retention configuration</h2> <p>To view what, if any, retention configuration is set on an object:</p> <div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="console_3" data-text="Console" tabindex="-1">Console</h3><ol> <li>In the Google Cloud console, go to the Cloud Storage <b>Buckets</b> page.<br> <p><a class="button button-primary" href="https://console.cloud.google.com/storage/browser" target="console">Go to Buckets</a></p></li> <li><p>In the list of buckets, click the name of the bucket that contains the object whose retention configuration you want to view.</p> <p>The <strong>Bucket details</strong> page opens, with the <strong>Objects</strong> tab selected.</p></li> <li><p>Navigate to the object, which might be located in a folder.</p></li> <li><p>Click the name of the object.</p> <p>The <strong>Object details</strong> page opens, which displays object metadata. Information about any retention configuration the object has is shown in the <strong>Protection</strong> section.</p></li> </ol></section> <section><h3 id="command-line_3" data-text="Command line" tabindex="-1">Command line</h3><p>Use the <a href="/sdk/gcloud/reference/storage/objects/describe"><code translate="no" dir="ltr">gcloud storage objects describe</code></a> command with the <code translate="no" dir="ltr">--format</code> flag:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded>gcloud storage objects describe gs://<var translate="no">BUCKET_NAME</var>/<var translate="no">OBJECT_NAME</var> --format="default(retention_settings)"</pre></devsite-code> <p>Where:</p> <ul> <li><p><code translate="no" dir="ltr"><var translate="no">BUCKET_NAME</var></code> is the name of the relevant bucket. For example, <code translate="no" dir="ltr">my-bucket</code>.</p></li> <li><p><code translate="no" dir="ltr"><var translate="no">OBJECT_NAME</var></code> is the name of the relevant object. For example, <code translate="no" dir="ltr">kitten.png</code>.</p></li> </ul> <p>If successful and a retention configuration exists for the object, the response is similar to the following:</p> <div></div><devsite-code><pre class="readonly" translate="no" dir="ltr" is-upgraded> retention_settings: mode: Unlocked retainUntilTime: '2028-11-30T14:11:14+00:00' </pre></devsite-code> <p>If successful and a retention configuration does not exist for the object, the response is similar to the following:</p> <div></div><devsite-code><pre class="readonly" translate="no" dir="ltr" is-upgraded>null</pre></devsite-code></section> <section><h3 id="client-libraries_3" data-text="Client libraries" tabindex="-1">Client libraries</h3><p> <section> <div id="storage-get-object-retention-code-sample" class="ds-selector-tabs" data-ds-scope="code-sample"> <section> <h3 id="storage-get-object-retention-cpp" track-metadata-position="storage-get-object-retention" track-metadata-region-tag="storage-get-object-retention" data-text="C++" tabindex="-1"><span class="notranslate">C++</span></h3> <p> For more information, see the <a href="/cpp/docs/reference/storage/latest" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="cpp" track-metadata-snippet-file-url="https://github.com/googleapis/google-cloud-cpp/blob//google/cloud/storage/examples/storage_object_samples.cc" track-metadata-region-tag="storage-get-object-retention">Cloud Storage <span class="notranslate">C++</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> To view an object's retention configuration, follow the instructions for displaying a object's metadata and look for the retention field in the response. <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="googleapis/google-cloud-cpp/google/cloud/storage/examples/storage_object_samples.cc/HEAD/storage_get_metadata" data-code-snippet="true" data-github-includecode-link="https://github.com/googleapis/google-cloud-cpp/blob/HEAD/google/cloud/storage/examples/storage_object_samples.cc" feedback-context="{&#34;language&#34;: &#34;cpp&#34;, &#34;region_tag&#34;: &#34;storage-get-object-retention&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/googleapis/google-cloud-cpp/blob/HEAD/google/cloud/storage/examples/storage_object_samples.cc&#34;}" feedback-product="1634365" feedback-bucket="storage" language="cpp" data-github-path="googleapis/google-cloud-cpp/google/cloud/storage/examples/storage_object_samples.cc" data-git-revision="HEAD" data-region-tag="storage_get_metadata" dir="ltr" is-upgraded syntax="C++"><code translate="no" dir="ltr"><span class="devsite-syntax-k">namespace</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">gcs</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-nn">google</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-nn">cloud</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-nn">storage</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">google</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">cloud</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">StatusOr</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-p">[](</span><span class="devsite-syntax-n">gcs</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">Client</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">client</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">const</span>&amp;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">const</span>&amp;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">object_name</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">StatusOr&lt;gcs</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">ObjectMetadata</span>&gt;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">object_metadata</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">client</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">GetObjectMetadata</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">object_name</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-o">!</span><span class="devsite-syntax-n">object_metadata</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">throw</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">move</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">object_metadata</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-n">status</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">std</span><span class="devsite-syntax-o">::</span><span class="devsite-syntax-n">cout</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-s">"The metadata for object "</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-n">object_metadata</span><span class="devsite-syntax-o">-</span>&gt;<span class="devsite-syntax-n">name</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-s">" in bucket "</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-n">object_metadata</span><span class="devsite-syntax-o">-</span>&gt;<span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-s">" is "</span> <span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-o">*</span><span class="devsite-syntax-n">object_metadata</span><span class="devsite-syntax-w"> &lt;&lt; </span><span class="devsite-syntax-s">"</span><span class="devsite-syntax-se">\n</span><span class="devsite-syntax-s">"</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-p">}</span></code></pre></devsite-code> </div> </section> <section> <h3 id="storage-get-object-retention-csharp" track-metadata-position="storage-get-object-retention" track-metadata-region-tag="storage-get-object-retention" data-text="C#" tabindex="-1"><span class="notranslate">C#</span></h3> <p> For more information, see the <a href="https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Storage.V1/latest" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="csharp" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob//storage/api/Storage.Samples/GetMetadata.cs" track-metadata-region-tag="storage-get-object-retention">Cloud Storage <span class="notranslate">C#</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> To view an object's retention configuration, follow the instructions for displaying a object's metadata and look for the retention field in the response. <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/dotnet-docs-samples/storage/api/Storage.Samples/GetMetadata.cs/HEAD/storage_get_metadata" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob/HEAD/storage/api/Storage.Samples/GetMetadata.cs" feedback-context="{&#34;language&#34;: &#34;csharp&#34;, &#34;region_tag&#34;: &#34;storage-get-object-retention&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob/HEAD/storage/api/Storage.Samples/GetMetadata.cs&#34;}" feedback-product="1634365" feedback-bucket="storage" language="csharp" data-github-path="GoogleCloudPlatform/dotnet-docs-samples/storage/api/Storage.Samples/GetMetadata.cs" data-git-revision="HEAD" data-region-tag="storage_get_metadata" dir="ltr" is-upgraded syntax="C#"><code translate="no" dir="ltr"> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">Google.Cloud.Storage.V1</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">using</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">System</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-k">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">class</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nc">GetMetadataSample</span> <span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Google</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Apis</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">v1</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Data</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Object</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">GetMetadata</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucketName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"your-unique-bucket-name"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">string</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">objectName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"your-object-name"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">var</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">StorageClient</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Create</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">var</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storageObject</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">GetObject</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucketName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">objectName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">GetObjectOptions</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Projection</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Projection</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Full</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">});</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Bucket:\t{storageObject.Bucket}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"CacheControl:\t{storageObject.CacheControl}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"ComponentCount:\t{storageObject.ComponentCount}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"ContentDisposition:\t{storageObject.ContentDisposition}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"ContentEncoding:\t{storageObject.ContentEncoding}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"ContentLanguage:\t{storageObject.ContentLanguage}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"ContentType:\t{storageObject.ContentType}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Crc32c:\t{storageObject.Crc32c}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"ETag:\t{storageObject.ETag}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Generation:\t{storageObject.Generation}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Id:\t{storageObject.Id}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Kind:\t{storageObject.Kind}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"KmsKeyName:\t{storageObject.KmsKeyName}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Md5Hash:\t{storageObject.Md5Hash}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"MediaLink:\t{storageObject.MediaLink}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Metageneration:\t{storageObject.Metageneration}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Name:\t{storageObject.Name}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Retention:\t{storageObject.Retention}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Size:\t{storageObject.Size}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"StorageClass:\t{storageObject.StorageClass}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"TimeCreated:\t{storageObject.TimeCreated}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"Updated:\t{storageObject.Updated}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">bool</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">eventBasedHold</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storageObject</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">EventBasedHold</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">??</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">false</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Event-based hold enabled? {0}"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">eventBasedHold</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">bool</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">temporaryHold</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storageObject</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">TemporaryHold</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">??</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">false</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Temporary hold enabled? {0}"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">temporaryHold</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"RetentionExpirationTime\t{storageObject.RetentionExpirationTime}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">storageObject</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Metadata</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">null</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Metadata: "</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">foreach</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kt">var</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">metadata</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">in</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storageObject</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">Metadata</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"{metadata.Key}:\t{metadata.Value}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-n">WriteLine</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">$"CustomTime:\t{storageObject.CustomTime}"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">return</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storageObject</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span></code></pre></devsite-code> </div> </section> <section> <h3 id="storage-get-object-retention-java" track-metadata-position="storage-get-object-retention" track-metadata-region-tag="storage-get-object-retention" data-text="Java" tabindex="-1"><span class="notranslate">Java</span></h3> <p> For more information, see the <a href="https://cloud.google.com/java/docs/reference/google-cloud-storage/latest/overview" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="java" track-metadata-snippet-file-url="https://github.com/googleapis/java-storage/blob//samples/snippets/src/main/java/com/example/storage/object/GetObjectMetadata.java" track-metadata-region-tag="storage-get-object-retention">Cloud Storage <span class="notranslate">Java</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> To view an object's retention configuration, follow the instructions for displaying a object's metadata and look for the retention field in the response. <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="googleapis/java-storage/samples/snippets/src/main/java/com/example/storage/object/GetObjectMetadata.java/HEAD/storage_get_metadata" data-code-snippet="true" data-github-includecode-link="https://github.com/googleapis/java-storage/blob/HEAD/samples/snippets/src/main/java/com/example/storage/object/GetObjectMetadata.java" feedback-context="{&#34;language&#34;: &#34;java&#34;, &#34;region_tag&#34;: &#34;storage-get-object-retention&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/googleapis/java-storage/blob/HEAD/samples/snippets/src/main/java/com/example/storage/object/GetObjectMetadata.java&#34;}" feedback-product="1634365" feedback-bucket="storage" language="java" data-github-path="googleapis/java-storage/samples/snippets/src/main/java/com/example/storage/object/GetObjectMetadata.java" data-git-revision="HEAD" data-region-tag="storage_get_metadata" dir="ltr" is-upgraded syntax="Java"><code translate="no" dir="ltr"> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.Blob</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.Storage</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.StorageException</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">com.google.cloud.storage.StorageOptions</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.Date</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kn">import</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nn">java.util.Map</span><span class="devsite-syntax-p">;</span> <span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">class</span> <span class="devsite-syntax-nc">GetObjectMetadata</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">public</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">static</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kt">void</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nf">getObjectMetadata</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">bucketName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blobName</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">throws</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">StorageException</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The ID of your GCP project</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// String projectId = "your-project-id";</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The ID of your GCS bucket</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// String bucketName = "your-unique-bucket-name";</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// The ID of your GCS object</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// String objectName = "your-object-name";</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Storage</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">StorageOptions</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">newBuilder</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">setProjectId</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">projectId</span><span class="devsite-syntax-p">).</span><span class="devsite-syntax-na">build</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">getService</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Select all fields</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Fields can be selected individually e.g. Storage.BlobField.CACHE_CONTROL</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Blob</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">get</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucketName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blobName</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">BlobGetOption</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">fields</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">Storage</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">BlobField</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">values</span><span class="devsite-syntax-p">()));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Print blob metadata</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Bucket: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getBucket</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"CacheControl: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getCacheControl</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"ComponentCount: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getComponentCount</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"ContentDisposition: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getContentDisposition</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"ContentEncoding: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getContentEncoding</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"ContentLanguage: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getContentLanguage</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"ContentType: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getContentType</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"CustomTime: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getCustomTime</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Crc32c: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getCrc32c</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Crc32cHexString: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getCrc32cToHexString</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"ETag: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getEtag</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Generation: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getGeneration</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Id: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getBlobId</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"KmsKeyName: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getKmsKeyName</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Md5Hash: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getMd5</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Md5HexString: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getMd5ToHexString</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"MediaLink: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getMediaLink</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Metageneration: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getMetageneration</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Name: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getName</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Size: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getSize</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"StorageClass: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getStorageClass</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"TimeCreated: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Date</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getCreateTime</span><span class="devsite-syntax-p">()));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Last Metadata Update: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Date</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getUpdateTime</span><span class="devsite-syntax-p">()));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"Object Retention Policy: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getRetention</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Boolean</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">temporaryHoldIsEnabled</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getTemporaryHold</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">null</span><span class="devsite-syntax-w"> &amp;&amp; </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getTemporaryHold</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"temporaryHold: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">temporaryHoldIsEnabled</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">?</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"enabled"</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"disabled"</span><span class="devsite-syntax-p">));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Boolean</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">eventBasedHoldIsEnabled</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getEventBasedHold</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">null</span><span class="devsite-syntax-w"> &amp;&amp; </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getEventBasedHold</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"eventBasedHold: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">eventBasedHoldIsEnabled</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">?</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"enabled"</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"disabled"</span><span class="devsite-syntax-p">));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getRetentionExpirationTime</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">null</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"retentionExpirationTime: "</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">Date</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getRetentionExpirationTime</span><span class="devsite-syntax-p">()));</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getMetadata</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">!=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">null</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"\n\n\nUser metadata:"</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">for</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">Map</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">Entry&lt;String</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">String</span>&gt;<span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">userMetadata</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getMetadata</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-na">entrySet</span><span class="devsite-syntax-p">())</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">System</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">out</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">println</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">userMetadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getKey</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"="</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">userMetadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">getValue</span><span class="devsite-syntax-p">());</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span></code></pre></devsite-code> </div> </section> <section> <h3 id="storage-get-object-retention-nodejs" track-metadata-position="storage-get-object-retention" track-metadata-region-tag="storage-get-object-retention" data-text="Node.js" tabindex="-1"><span class="notranslate">Node.js</span></h3> <p> For more information, see the <a href="https://cloud.google.com/nodejs/docs/reference/storage/latest" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="nodejs" track-metadata-snippet-file-url="https://github.com/googleapis/nodejs-storage/blob//samples/getMetadata.js" track-metadata-region-tag="storage-get-object-retention">Cloud Storage <span class="notranslate">Node.js</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> To view an object's retention configuration, follow the instructions for displaying a object's metadata and look for the retention field in the response. <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="googleapis/nodejs-storage/samples/getMetadata.js/HEAD/storage_get_metadata" data-code-snippet="true" data-github-includecode-link="https://github.com/googleapis/nodejs-storage/blob/HEAD/samples/getMetadata.js" feedback-context="{&#34;language&#34;: &#34;nodejs&#34;, &#34;region_tag&#34;: &#34;storage-get-object-retention&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/googleapis/nodejs-storage/blob/HEAD/samples/getMetadata.js&#34;}" feedback-product="1634365" feedback-bucket="storage" language="nodejs" data-github-path="googleapis/nodejs-storage/samples/getMetadata.js" data-git-revision="HEAD" data-region-tag="storage_get_metadata" dir="ltr" is-upgraded syntax="JavaScript"><code translate="no" dir="ltr"><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * TODO(developer): Uncomment the following lines before running the sample.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-c1">// The ID of your GCS bucket</span> <span class="devsite-syntax-c1">// const bucketName = 'your-unique-bucket-name';</span> <span class="devsite-syntax-c1">// The ID of your GCS file</span> <span class="devsite-syntax-c1">// const fileName = 'your-file-name';</span> <span class="devsite-syntax-c1">// Imports the Google Cloud client library</span> <span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span><span class="devsite-syntax-nx">Storage</span><span class="devsite-syntax-p">}</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">require</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'@google-cloud/storage'</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-c1">// Creates a client</span> <span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">storage</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">Storage</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-k">async</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">function</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">getMetadata</span><span class="devsite-syntax-p">()</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Gets the metadata for the file</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">await</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">storage</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">bucket</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">bucketName</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">file</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">fileName</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">getMetadata</span><span class="devsite-syntax-p">();</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`Bucket: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">bucket</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`CacheControl: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">cacheControl</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`ComponentCount: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">componentCount</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`ContentDisposition: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">contentDisposition</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`ContentEncoding: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">contentEncoding</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`ContentLanguage: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">contentLanguage</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`ContentType: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">contentType</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`CustomTime: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">customTime</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`Crc32c: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">crc32c</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`ETag: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">etag</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`Generation: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">generation</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`Id: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">id</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`KmsKeyName: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">kmsKeyName</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`Md5Hash: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">md5Hash</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`MediaLink: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">mediaLink</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`Metageneration: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">metageneration</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`Name: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`Size: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">size</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`StorageClass: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">storageClass</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`TimeCreated: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">Date</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">timeCreated</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`Last Metadata Update: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">Date</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">updated</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`TurboReplication: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">rpo</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sb">`temporaryHold: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">temporaryHold</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">?</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'enabled'</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'disabled'</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sb">`eventBasedHold: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">eventBasedHold</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">?</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'enabled'</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'disabled'</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">retentionExpirationTime</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sb">`retentionExpirationTime: </span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-ow">new</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nb">Date</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">retentionExpirationTime</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">if</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s1">'\n\n\nUser metadata:'</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-k">for</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-kd">const</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">key</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-ow">in</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">log</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">key</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">=</span><span class="devsite-syntax-si">${</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">metadata</span><span class="devsite-syntax-p">[</span><span class="devsite-syntax-nx">key</span><span class="devsite-syntax-p">]</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-sb">`</span><span class="devsite-syntax-p">);</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span> <span class="devsite-syntax-nx">getMetadata</span><span class="devsite-syntax-p">().</span><span class="devsite-syntax-k">catch</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-nx">console</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-nx">error</span><span class="devsite-syntax-p">);</span></code></pre></devsite-code> </div> </section> <section> <h3 id="storage-get-object-retention-php" track-metadata-position="storage-get-object-retention" track-metadata-region-tag="storage-get-object-retention" data-text="PHP" tabindex="-1"><span class="notranslate">PHP</span></h3> <p> For more information, see the <a href="https://googleapis.github.io/google-cloud-php/#/docs/google-cloud/latest/storage/storageclient" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="php" track-metadata-snippet-file-url="https://github.com/GoogleCloudPlatform/php-docs-samples/blob//storage/src/object_metadata.php" track-metadata-region-tag="storage-get-object-retention">Cloud Storage <span class="notranslate">PHP</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> To view an object's retention configuration, follow the instructions for displaying a object's metadata and look for the retention field in the response. <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="GoogleCloudPlatform/php-docs-samples/storage/src/object_metadata.php/HEAD/storage_get_metadata" data-code-snippet="true" data-github-includecode-link="https://github.com/GoogleCloudPlatform/php-docs-samples/blob/HEAD/storage/src/object_metadata.php" feedback-context="{&#34;language&#34;: &#34;php&#34;, &#34;region_tag&#34;: &#34;storage-get-object-retention&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/GoogleCloudPlatform/php-docs-samples/blob/HEAD/storage/src/object_metadata.php&#34;}" feedback-product="1634365" feedback-bucket="storage" language="php" data-github-path="GoogleCloudPlatform/php-docs-samples/storage/src/object_metadata.php" data-git-revision="HEAD" data-region-tag="storage_get_metadata" dir="ltr" is-upgraded syntax="PHP"><code translate="no" dir="ltr"><span class="devsite-syntax-x">use Google\Cloud\Storage\StorageClient;</span> <span class="devsite-syntax-x">/**</span> <span class="devsite-syntax-x"> * List object metadata.</span> <span class="devsite-syntax-x"> *</span> <span class="devsite-syntax-x"> * @param string $bucketName The name of your Cloud Storage bucket.</span> <span class="devsite-syntax-x"> * (e.g. 'my-bucket')</span> <span class="devsite-syntax-x"> * @param string $objectName The name of your Cloud Storage object.</span> <span class="devsite-syntax-x"> * (e.g. 'my-object')</span> <span class="devsite-syntax-x"> */</span> <span class="devsite-syntax-x">function object_metadata(string $bucketName, string $objectName): void</span> <span class="devsite-syntax-x">{</span> <span class="devsite-syntax-x"> $storage = new StorageClient();</span> <span class="devsite-syntax-x"> $bucket = $storage-&gt;bucket($bucketName);</span> <span class="devsite-syntax-x"> $object = $bucket-&gt;object($objectName);</span> <span class="devsite-syntax-x"> $info = $object-&gt;info();</span> <span class="devsite-syntax-x"> if (isset($info['name'])) {</span> <span class="devsite-syntax-x"> printf('Blob: %s' . PHP_EOL, $info['name']);</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x"> if (isset($info['bucket'])) {</span> <span class="devsite-syntax-x"> printf('Bucket: %s' . PHP_EOL, $info['bucket']);</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x"> if (isset($info['storageClass'])) {</span> <span class="devsite-syntax-x"> printf('Storage class: %s' . PHP_EOL, $info['storageClass']);</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x"> if (isset($info['id'])) {</span> <span class="devsite-syntax-x"> printf('ID: %s' . PHP_EOL, $info['id']);</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x"> if (isset($info['size'])) {</span> <span class="devsite-syntax-x"> printf('Size: %s' . PHP_EOL, $info['size']);</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x"> if (isset($info['updated'])) {</span> <span class="devsite-syntax-x"> printf('Updated: %s' . PHP_EOL, $info['updated']);</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x"> if (isset($info['generation'])) {</span> <span class="devsite-syntax-x"> printf('Generation: %s' . PHP_EOL, $info['generation']);</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x"> if (isset($info['metageneration'])) {</span> <span class="devsite-syntax-x"> printf('Metageneration: %s' . PHP_EOL, $info['metageneration']);</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x"> if (isset($info['etag'])) {</span> <span class="devsite-syntax-x"> printf('Etag: %s' . PHP_EOL, $info['etag']);</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x"> if (isset($info['crc32c'])) {</span> <span class="devsite-syntax-x"> printf('Crc32c: %s' . PHP_EOL, $info['crc32c']);</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x"> if (isset($info['md5Hash'])) {</span> <span class="devsite-syntax-x"> printf('MD5 Hash: %s' . PHP_EOL, $info['md5Hash']);</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x"> if (isset($info['contentType'])) {</span> <span class="devsite-syntax-x"> printf('Content-type: %s' . PHP_EOL, $info['contentType']);</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x"> if (isset($info['temporaryHold'])) {</span> <span class="devsite-syntax-x"> printf('Temporary hold: %s' . PHP_EOL, ($info['temporaryHold'] ? 'enabled' : 'disabled'));</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x"> if (isset($info['eventBasedHold'])) {</span> <span class="devsite-syntax-x"> printf('Event-based hold: %s' . PHP_EOL, ($info['eventBasedHold'] ? 'enabled' : 'disabled'));</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x"> if (isset($info['retentionExpirationTime'])) {</span> <span class="devsite-syntax-x"> printf('Retention Expiration Time: %s' . PHP_EOL, $info['retentionExpirationTime']);</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x"> if (isset($info['retention'])) {</span> <span class="devsite-syntax-x"> printf('Retention mode: %s' . PHP_EOL, $info['retention']['mode']);</span> <span class="devsite-syntax-x"> printf('Retain until time is: %s' . PHP_EOL, $info['retention']['retainUntilTime']);</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x"> if (isset($info['customTime'])) {</span> <span class="devsite-syntax-x"> printf('Custom Time: %s' . PHP_EOL, $info['customTime']);</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x"> if (isset($info['metadata'])) {</span> <span class="devsite-syntax-x"> printf('Metadata: %s' . PHP_EOL, print_r($info['metadata'], true));</span> <span class="devsite-syntax-x"> }</span> <span class="devsite-syntax-x">}</span></code></pre></devsite-code> </div> </section> <section> <h3 id="storage-get-object-retention-python" track-metadata-position="storage-get-object-retention" track-metadata-region-tag="storage-get-object-retention" data-text="Python" tabindex="-1"><span class="notranslate">Python</span></h3> <p> For more information, see the <a href="https://cloud.google.com/python/docs/reference/storage/latest" class="external" track-type="clientLibrariesUsage" track-name="clientLibrariesLink" track-metadata-lang="python" track-metadata-snippet-file-url="https://github.com/googleapis/python-storage/blob//samples/snippets/storage_get_metadata.py" track-metadata-region-tag="storage-get-object-retention">Cloud Storage <span class="notranslate">Python</span> API reference documentation</a>. </p> <p> To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see <a href="/storage/docs/authentication#client-libs">Set up authentication for client libraries</a>. </p> To view an object's retention configuration, follow the instructions for displaying a object's metadata and look for the retention field in the response. <div class="github-docwidget-gitinclude-code"> <div></div><devsite-code><pre suppresswarning="suppresswarning" translate="no" class="devsite-click-to-copy" track-metadata-position="googleapis/python-storage/samples/snippets/storage_get_metadata.py/HEAD/storage_get_metadata" data-code-snippet="true" data-github-includecode-link="https://github.com/googleapis/python-storage/blob/HEAD/samples/snippets/storage_get_metadata.py" feedback-context="{&#34;language&#34;: &#34;python&#34;, &#34;region_tag&#34;: &#34;storage-get-object-retention&#34;, &#34;snippet_file_url&#34;: &#34;https://github.com/googleapis/python-storage/blob/HEAD/samples/snippets/storage_get_metadata.py&#34;}" feedback-product="1634365" feedback-bucket="storage" language="python" data-github-path="googleapis/python-storage/samples/snippets/storage_get_metadata.py" data-git-revision="HEAD" data-region-tag="storage_get_metadata" dir="ltr" is-upgraded syntax="Python"><code translate="no" dir="ltr"><span class="devsite-syntax-kn">from</span> <span class="devsite-syntax-nn">google.cloud</span> <span class="devsite-syntax-kn">import</span> <span class="devsite-syntax-n">storage</span> <span class="devsite-syntax-k">def</span> <span class="devsite-syntax-nf">blob_metadata</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-n">blob_name</span><span class="devsite-syntax-p">):</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-sd">"""Prints out a blob's metadata."""</span> <span class="devsite-syntax-c1"># bucket_name = 'your-bucket-name'</span> <span class="devsite-syntax-c1"># blob_name = 'your-object-name'</span> <span class="devsite-syntax-n">storage_client</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">storage</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">Client</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-n">bucket</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">storage_client</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">bucket_name</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-c1"># Retrieve a blob, and its metadata, from Google Cloud Storage.</span> <span class="devsite-syntax-c1"># Note that `get_blob` differs from `Bucket.blob`, which does not</span> <span class="devsite-syntax-c1"># make an HTTP request.</span> <span class="devsite-syntax-n">blob</span> <span class="devsite-syntax-o">=</span> <span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">get_blob</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">blob_name</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Blob: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Bucket: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">bucket</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">name</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Storage class: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">storage_class</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"ID: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">id</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Size: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">size</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2"> bytes"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Updated: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">updated</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Generation: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">generation</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Metageneration: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">metageneration</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Etag: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">etag</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Owner: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">owner</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Component count: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">component_count</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Crc32c: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">crc32c</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"md5_hash: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">md5_hash</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Cache-control: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">cache_control</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Content-type: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">content_type</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Content-disposition: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">content_disposition</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Content-encoding: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">content_encoding</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Content-language: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">content_language</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Metadata: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">metadata</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Medialink: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">media_link</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Custom Time: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">custom_time</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s2">"Temporary hold: "</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"enabled"</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">temporary_hold</span> <span class="devsite-syntax-k">else</span> <span class="devsite-syntax-s2">"disabled"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-s2">"Event based hold: "</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-s2">"enabled"</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">event_based_hold</span> <span class="devsite-syntax-k">else</span> <span class="devsite-syntax-s2">"disabled"</span><span class="devsite-syntax-p">,</span> <span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Retention mode: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">retention</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">mode</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"Retention retain until time: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">retention</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">retain_until_time</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-k">if</span> <span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">retention_expiration_time</span><span class="devsite-syntax-p">:</span> <span class="devsite-syntax-nb">print</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-sa">f</span><span class="devsite-syntax-s2">"retentionExpirationTime: </span><span class="devsite-syntax-si">{</span><span class="devsite-syntax-n">blob</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-n">retention_expiration_time</span><span class="devsite-syntax-si">}</span><span class="devsite-syntax-s2">"</span> <span class="devsite-syntax-p">)</span> </code></pre></devsite-code> </div> </section> </div> </section> </p></section> <section><h3 id="rest-apis_3" data-text="REST APIs" tabindex="-1">REST APIs</h3><div class="ds-selector-tabs" data-ds-scope="code-sample"> <section><h3 id="json-api_3" data-text="JSON API" tabindex="-1">JSON API</h3><ol> <li><p>Have gcloud CLI <a href="/sdk/docs/install">installed and initialized<a>, which lets you generate an access token for the <code translate="no" dir="ltr">Authorization</code> header.</p></li> <li><p>Use <a href="http://curl.haxx.se/" class="external"><code translate="no" dir="ltr">cURL</code></a> to call the JSON API with a <a href="/storage/docs/json_api/v1/objects/get"><code translate="no" dir="ltr">GET</code> Object</a> request that includes the <code translate="no" dir="ltr">retention</code> field:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded>curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://storage.googleapis.com/storage/v1/b/<var translate="no">BUCKET_NAME</var>/<var translate="no">OBJECT_NAME</var>?fields=retention"</pre></devsite-code> <p>Where:</p> <ul> <li><code translate="no" dir="ltr"><var translate="no">BUCKET_NAME</var></code> is the name of the relevant bucket. For example, <code translate="no" dir="ltr">my-bucket</code>.</li> <li><code translate="no" dir="ltr"><var translate="no">OBJECT_NAME</var></code> is the name of the relevant object. For example, <code translate="no" dir="ltr">kitten.png</code>.</li> </ul></li> </ol></section> <section><h3 id="xml-api_3" data-text="XML API" tabindex="-1">XML API</h3><ol> <li><p>Have gcloud CLI <a href="/sdk/docs/install">installed and initialized<a>, which lets you generate an access token for the <code translate="no" dir="ltr">Authorization</code> header.</p></li> <li><p>Use <a href="http://curl.haxx.se/" class="external"><code translate="no" dir="ltr">cURL</code></a> to call the XML API with a <a href="/storage/docs/xml-api/get-object-retention"><code translate="no" dir="ltr">GET</code> Object</a> request scoped to <code translate="no" dir="ltr">?retention</code>:</p> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded>curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://storage.googleapis.com/<var translate="no">BUCKET_NAME</var>/<var translate="no">OBJECT_NAME</var>?retention"</pre></devsite-code> <p>Where:</p> <ul> <li><code translate="no" dir="ltr"><var translate="no">BUCKET_NAME</var></code> is the name of the relevant bucket. For example, <code translate="no" dir="ltr">my-bucket</code>.</li> <li><code translate="no" dir="ltr"><var translate="no">OBJECT_NAME</var></code> is the name of the relevant object. For example, <code translate="no" dir="ltr">kitten.png</code>.</li> </ul></li> </ol></section> </div></section> </div> <h2 id="whats_next" data-text="What's next" tabindex="-1">What's next</h2> <ul> <li>Learn more about <a href="/storage/docs/object-lock">retention configurations</a>.</li> <li>Learn about other <a href="/storage/docs/control-data-lifecycles">features that protect your Cloud Storage data</a>.</li> <li>Learn about <a href="/storage/docs/lifecycle">Object Lifecycle Management</a>, which can automatically delete files once they reach their retention period.</li> </ul> <devsite-hats-survey class="nocontent" hats-id="mwETRvWii0eU5NUYprb0Y9z5GVbc" listnr-id="83405"></devsite-hats-survey> </div> <devsite-thumb-rating position="footer"> </devsite-thumb-rating> <devsite-feedback position="footer" project-name="Cloud Storage" product-id="81864" bucket="documentation" context="" version="t-devsite-webserver-20241114-r00-rc02.464922260396498922" data-label="Send Feedback Button" track-type="feedback" track-name="sendFeedbackLink" track-metadata-position="footer" class="nocontent" project-feedback-url="https://issuetracker.google.com/issues/new?component=187243" project-icon="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/super_cloud.png" project-support-url="https://cloud.google.com/support-hub" > <button> Send feedback </button> </devsite-feedback> <div class="devsite-floating-action-buttons"> </div> </article> <devsite-content-footer class="nocontent"> <p>Except as otherwise noted, the content of this page is licensed under the <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 License</a>, and code samples are licensed under the <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache 2.0 License</a>. For details, see the <a href="https://developers.google.com/site-policies">Google Developers Site Policies</a>. Java is a registered trademark of Oracle and/or its affiliates.</p> <p>Last updated 2024-11-22 UTC.</p> </devsite-content-footer> <devsite-notification > </devsite-notification> <div class="devsite-content-data"> <template class="devsite-thumb-rating-feedback"> <devsite-feedback position="thumb-rating" project-name="Cloud Storage" product-id="81864" bucket="documentation" context="" version="t-devsite-webserver-20241114-r00-rc02.464922260396498922" data-label="Send Feedback Button" track-type="feedback" track-name="sendFeedbackLink" track-metadata-position="thumb-rating" class="nocontent" project-feedback-url="https://issuetracker.google.com/issues/new?component=187243" project-icon="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/super_cloud.png" project-support-url="https://cloud.google.com/support-hub" > <button> Need to tell us more? </button> </devsite-feedback> </template> <template class="devsite-content-data-template"> [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-22 UTC."],[],[]] </template> </div> </devsite-content> </main> <devsite-footer-promos class="devsite-footer"> </devsite-footer-promos> <devsite-footer-linkboxes class="devsite-footer"> <nav class="devsite-footer-linkboxes nocontent" aria-label="Footer links"> <ul class="devsite-footer-linkboxes-list"> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Why Google</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/why-google-cloud/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/why-google-cloud/"track-metadata-module="footer"track-type="footer link"track-metadata-child_headline="why google"track-name="choosing google cloud"> Choosing Google Cloud </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/trust-center/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" track-name="trust and security"track-metadata-module="footer"track-metadata-position="footer"track-type="footer link"track-metadata-eventDetail="cloud.google.com/security/"track-metadata-child_headline="why google"> Trust and security </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/modern-infrastructure/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" track-name="modern infrastructure cloud"track-metadata-child_headline="why google"track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/solutions/modern-infrastructure/"track-metadata-module="footer"track-type="footer link"> Modern Infrastructure Cloud </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/multicloud/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" track-metadata-eventDetail="cloud.google.com/multicloud/"track-metadata-module="footer"track-name="multicloud"track-metadata-child_headline="why google"track-metadata-position="footer"track-type="footer link"> Multicloud </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/infrastructure/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" track-type="footer link"track-metadata-module="footer"track-metadata-eventDetail="cloud.google.com/infrastructure/"track-metadata-position="footer"track-name="global infrastructure"track-metadata-child_headline="why google"> Global infrastructure </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/customers/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 6)" track-metadata-module="footer"track-type="footer link"track-name="customers and case studies"track-metadata-child_headline="why google"track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/customers/"> Customers and case studies </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/analyst-reports/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 7)" track-metadata-position="footer"track-type="footer link"track-metadata-child_headline="why google"track-metadata-module="footer"track-name="analyst reports"track-metadata-eventDetail="cloud.google.com/analyst-reports/"> Analyst reports </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/whitepapers/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 8)" track-type="footer link"track-metadata-child_headline="why google"track-metadata-module="footer"track-name="whitepapers"track-metadata-eventDetail="cloud.google.com/whitepapers/"track-metadata-position="footer"> Whitepapers </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//cloud.google.com/blog/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 9)" track-metadata-position="footer"track-metadata-module="footer"track-type="footer link"track-name="blog"track-metadata-eventDetail="cloud.google.com/blog/"track-metadata-child_headline="engage"> Blog </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Products and pricing</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/pricing/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" track-metadata-eventDetail="cloud.google.com/pricing/"track-metadata-position="footer"track-metadata-child_headline="products and pricing"track-name="google cloud pricing"track-type="footer link"track-metadata-module="footer"> Google Cloud pricing </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//workspace.google.com/pricing.html" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" track-metadata-module="footer"track-metadata-eventDetail="workspace.google.com/pricing.html"track-name="google workspace pricing"track-metadata-child_headline="products and pricing"target="_blank"track-metadata-position="footer"track-type="footer link"> Google Workspace pricing </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/products/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" track-metadata-child_headline="products and pricing"track-metadata-module="footer"track-metadata-position="footer"track-type="footer link"track-metadata-eventDetail="cloud.google.com/products/"track-name="see all products"> See all products </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Solutions</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/solutions/infrastructure-modernization/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" track-metadata-module="footer"track-metadata-position="footer"track-metadata-child_headline="solutions"track-type="footer link"track-metadata-eventDetail="cloud.google.com/solutions/infrastructure-modernization/"track-name="infrastructure modernization"> Infrastructure modernization </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/databases/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" track-metadata-position="footer"track-name="databases"track-metadata-eventDetail="cloud.google.com/solutions/databases"track-metadata-child_headline="solutions"track-type="footer link"track-metadata-module="footer"> Databases </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/application-modernization/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" track-metadata-child_headline="solutions"track-metadata-eventDetail="cloud.google.com/solutions/application-modernization/"track-metadata-position="footer"track-metadata-module="footer"track-type="footer link"track-name="application development"> Application modernization </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/smart-analytics/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" track-metadata-child_headline="solutions"track-name="smart analytics"track-metadata-eventDetail="cloud.google.com/solutions/smart-analytics/"track-metadata-position="footer"track-type="footer link"track-metadata-module="footer"> Smart analytics </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/ai/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" track-type="footer link"track-metadata-eventDetail="cloud.google.com/solutions/ai/"track-metadata-position="footer"track-metadata-module="footer"track-name="artificial intelligence"track-metadata-child_headline="solutions"> Artificial Intelligence </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/security/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 6)" track-metadata-eventDetail="cloud.google.com/solutions/security/"track-type="footer link"track-metadata-child_headline="solutions"track-name="security"track-metadata-position="footer"track-metadata-module="footer"> Security </a> </li> <li class="devsite-footer-linkbox-item"> <a href="https://workspace.google.com/enterprise/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 7)" track-type="footer link"target="_blank"track-name="productivity and work transformation"track-metadata-eventDetail="workspace.google.com/enterprise/"track-metadata-child_headline="solutions"track-metadata-position="footer"track-metadata-module="footer"> Productivity & work transformation </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/#industry-solutions" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 8)" track-metadata-position="footer"track-type="footer link"track-metadata-eventDetail="cloud.google.com/solutions/#industry-solutions"track-name="industry solutions"track-metadata-module="footer"track-metadata-child_headline="solutions"> Industry solutions </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/devops/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 9)" track-type="footer link"track-metadata-eventDetail="cloud.google.com/solutions/devops/"track-metadata-position="footer"track-metadata-child_headline="solutions"track-metadata-module="footer"track-name="devops solutions"> DevOps solutions </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/#section-14" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 10)" track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/solutions/#section-14"track-name="small business solutions"track-metadata-child_headline="solutions"track-metadata-module="footer"track-type="footer link"> Small business solutions </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/solutions/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 11)" track-name="see all solutions"track-metadata-child_headline="solutions"track-metadata-module="footer"track-metadata-position="footer"track-type="footer link"track-metadata-eventDetail="cloud.google.com/solutions/"> See all solutions </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Resources</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/affiliate-program/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" track-metadata-position="footer"track-type="footer link"track-metadata-module="footer"track-name="google cloud affiliate program"track-metadata-child_headline="resources"track-metadata-eventDetail="cloud.google.com/affiliate-program/"> Google Cloud Affiliate Program </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/docs/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" track-metadata-child_headline="resources"track-metadata-position="footer"track-metadata-module="footer"track-name="google cloud documentation"track-metadata-eventDetail="cloud.google.com/docs/"track-type="footer link"> Google Cloud documentation </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/docs/get-started/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" track-metadata-child_headline="resources"track-metadata-eventDetail="cloud.google.com/docs/get-started/"track-metadata-module="footer"track-metadata-position="footer"track-type="footer link"track-name="google cloud quickstarts"> Google Cloud quickstarts </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/marketplace/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" track-metadata-module="footer"track-name="google cloud marketplace"track-type="footer link"track-metadata-eventDetail="cloud.google.com/marketplace/"track-metadata-position="footer"track-metadata-child_headline="resources"> Google Cloud Marketplace </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/discover/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" track-metadata-child_headline="resources"track-type="footer link"track-name="learn about cloud computing"track-metadata-position="footer"track-metadata-module="footer"track-metadata-eventDetail="learn/"> Learn about cloud computing </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/support-hub/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 6)" track-metadata-module="footer"track-type="footer link"track-metadata-child_headline="resources"track-metadata-position="footer"track-name="support"track-metadata-eventDetail="cloud.google.com/support-hub/"> Support </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/docs/samples" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 7)" track-metadata-position="footer"track-type="footer link"track-metadata-module="footer"track-name="code samples"track-metadata-eventDetail="cloud.google.com/docs/samples"track-metadata-child_headline="resources"> Code samples </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/architecture/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 8)" track-metadata-module="footer"track-type="footer link"track-metadata-eventDetail="cloud.google.com/architecture/"track-metadata-child_headline="resources"track-metadata-position="footer"track-name="cloud architecture center"> Cloud Architecture Center </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/learn/training/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 9)" track-name="training"track-metadata-module="footer"track-metadata-position="footer"track-type="footer link"track-metadata-eventDetail="cloud.google.com/training/"track-metadata-child_headline="resources"> Training </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/learn/certification/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 10)" track-metadata-child_headline="resources"track-metadata-module="footer"track-name="certifications"track-type="footer link"track-metadata-eventDetail="cloud.google.com/certification"track-metadata-position="footer"> Certifications </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//developers.google.com" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 11)" track-name="google developers"track-metadata-position="footer"track-metadata-eventDetail="developers.google.com"track-type="footer link"track-metadata-module="footer"target="_blank"track-metadata-child_headline="resources"> Google for Developers </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/startup/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 12)" track-type="footer link"track-name="google cloud for startups"track-metadata-child_headline="resources"track-metadata-position="footer"track-metadata-eventDetail="cloud.google.com/startup/"track-metadata-module="footer"> Google Cloud for Startups </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//status.cloud.google.com" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 13)" track-name="system status"target="_blank"track-metadata-child_headline="resources"track-metadata-position="footer"track-metadata-module="footer"track-metadata-eventDetail="status.cloud.google.com"track-type="footer link"> System status </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/release-notes" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 14)" track-name="release notes"track-metadata-eventDetail="cloud.google.com/release-notes/"track-metadata-module="footer"track-metadata-position="footer"track-type="footer link"track-metadata-child_headline="resources"> Release Notes </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Engage</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/contact/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" track-metadata-eventDetail="cloud.google.com/contact/"track-metadata-child_headline="engage"track-name="contact sales"track-metadata-position="footer"track-type="footer link"track-metadata-module="footer"> Contact sales </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//cloud.google.com/find-a-partner" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" track-type="footer link"track-metadata-position="footer"track-metadata-child_headline="engage"track-metadata-eventDetail="cloud.google.com/find-a-partner"track-metadata-module="footer"track-name="find a partner"target="_blank"> Find a Partner </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/partners/become-a-partner/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" track-metadata-eventDetail="cloud.google.com/partners/become-a-partner/"track-metadata-child_headline="engage"track-metadata-module="footer"track-name="become a partner"track-metadata-position="footer"track-type="footer link"> Become a Partner </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/events/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" track-metadata-child_headline="engage"track-name="events"track-type="footer link"track-metadata-module="footer"track-metadata-position="footer"track-metadata-eventDetail="cloud.withgoogle.com/events"> Events </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/podcasts/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" rel="noopener"track-metadata-position="footer"track-metadata-module="footer"track-type="footer link"track-metadata-child_headline="engage"track-name="podcasts"track-metadata-eventDetail="cloud.google.com/podcasts/"target="_blank"> Podcasts </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/developers/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 6)" track-metadata-position="footer"track-name="developer center"track-metadata-eventDetail="cloud.google.com/developers/"track-type="footer link"track-metadata-child_headline="engage"track-metadata-module="footer"> Developer Center </a> </li> <li class="devsite-footer-linkbox-item"> <a href="https://www.googlecloudpresscorner.com/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 7)" track-metadata-child_headline="engage"track-type="footer link"track-metadata-module="footer"track-metadata-position="footer"target="_blank"rel="noopener"track-name="press corner"track-metadata-eventDetail="www.googlecloudpresscorner.com"> Press Corner </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//www.youtube.com/googlecloud" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 8)" track-metadata-child_headline="engage"track-metadata-module="footer"track-metadata-eventDetail="www.youtube.com/googlecloud"track-name="google cloud on youtube"target="_blank"track-type="footer link"track-metadata-position="footer"rel="noopener"> Google Cloud on YouTube </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//www.youtube.com/googlecloudplatform" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 9)" track-type="footer link"target="_blank"rel="noopener"track-metadata-position="footer"track-name="google cloud tech on youtube"track-metadata-module="footer"track-metadata-eventDetail="www.youtube.com/googlecloudplatform"track-metadata-child_headline="engage"> Google Cloud Tech on YouTube </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//x.com/googlecloud" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 10)" track-metadata-eventDetail="x.com/googlecloud"rel="noopener"track-metadata-child_headline="engage"track-metadata-position="footer"track-type="footer link"target="_blank"track-metadata-module="footer"track-name="follow on x"> Follow on X </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//userresearch.google.com/?reserved=1&amp;utm_source=website&amp;Q_Language=en&amp;utm_medium=own_srch&amp;utm_campaign=CloudWebFooter&amp;utm_term=0&amp;utm_content=0&amp;productTag=clou&amp;campaignDate=jul19&amp;pType=devel&amp;referral_code=jk212693" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 11)" track-metadata-module="footer"track-metadata-eventDetail="userresearch.google.com/?reserved=1&amp;utm_source=website&amp;Q_Language=en&amp;utm_medium=own_srch&amp;utm_campaign=CloudWebFooter&amp;utm_term=0&amp;utm_content=0&amp;productTag=clou&amp;campaignDate=jul19&amp;pType=devel&amp;referral_code=jk212693"track-type="footer link"track-metadata-child_headline="engage"target="_blank"track-metadata-position="footer"track-name="join user research"> Join User Research </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//careers.google.com/cloud" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 12)" track-type="footer link"track-metadata-eventDetail="careers.google.com/cloud"track-metadata-child_headline="engage"target="_blank"track-name="we are hiring join google cloud"track-metadata-module="footer"track-metadata-position="footer"> We're hiring. Join Google Cloud! </a> </li> <li class="devsite-footer-linkbox-item"> <a href="https://www.googlecloudcommunity.com/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 13)" track-metadata-child_headline="engage"track-metadata-position="footer"track-metadata-module="footer"track-type="footer link"track-name="google cloud community"track-metadata-eventDetail="www.googlecloudcommunity.com"target="_blank"rel="noopener"> Google Cloud Community </a> </li> </ul> </li> </ul> </nav> </devsite-footer-linkboxes> <devsite-footer-utility class="devsite-footer"> <div class="devsite-footer-utility nocontent"> <nav class="devsite-footer-utility-links" aria-label="Utility links"> <ul class="devsite-footer-utility-list"> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="//about.google/" data-category="Site-Wide Custom Events" data-label="Footer About Google link" track-metadata-module="utility footer" target="_blank" track-name="about google" track-metadata-position="footer" track-metadata-eventDetail="//about.google/" track-type="footer link" > About Google </a> </li> <li class="devsite-footer-utility-item devsite-footer-privacy-link"> <a class="devsite-footer-utility-link gc-analytics-event" href="//policies.google.com/privacy" data-category="Site-Wide Custom Events" data-label="Footer Privacy link" track-metadata-module="utility footer" track-metadata-position="footer" target="_blank" track-name="privacy" track-metadata-eventDetail="//policies.google.com/privacy" track-type="footer link" > Privacy </a> </li> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="//www.google.com/intl/en/policies/terms/regional.html" data-category="Site-Wide Custom Events" data-label="Footer Site terms link" target="_blank" track-metadata-module="utility footer" track-type="footer link" track-metadata-eventDetail="//www.google.com/intl/en/policies/terms/regional.html" track-metadata-position="footer" track-name="site terms" > Site terms </a> </li> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="/product-terms/" data-category="Site-Wide Custom Events" data-label="Footer Google Cloud terms link" track-metadata-eventDetail="/product-terms/" track-metadata-position="footer" track-metadata-module="utility footer" track-name="google cloud terms" track-type="footer link" > Google Cloud terms </a> </li> <li class="devsite-footer-utility-item glue-cookie-notification-bar-control"> <a class="devsite-footer-utility-link gc-analytics-event" href="#" data-category="Site-Wide Custom Events" data-label="Footer Manage cookies link" track-name="Manage cookies" track-metadata-eventDetail="#" track-type="footer link" track-metadata-module="utility footer" track-metadata-position="footer" aria-hidden="true" > Manage cookies </a> </li> <li class="devsite-footer-utility-item devsite-footer-carbon-button"> <a class="devsite-footer-utility-link gc-analytics-event" href="/sustainability" data-category="Site-Wide Custom Events" data-label="Footer Our third decade of climate action: join us link" track-metadata-module="utility footer" track-metadata-eventDetail="/sustainability/" track-metadata-position="footer" track-name="Our third decade of climate action: join us" track-type="footer link" > Our third decade of climate action: join us </a> </li> <li class="devsite-footer-utility-item devsite-footer-utility-button"> <span class="devsite-footer-utility-description">Sign up for the Google Cloud newsletter</span> <a class="devsite-footer-utility-link gc-analytics-event" href="/newsletter/" data-category="Site-Wide Custom Events" data-label="Footer Subscribe link" track-type="footer link" track-metadata-position="footer" track-metadata-eventDetail="/newsletter/" track-metadata-module="utility footer" track-name="subscribe" > Subscribe </a> </li> </ul> <devsite-language-selector> <ul role="presentation"> <li role="presentation"> <a role="menuitem" lang="en" >English</a> </li> <li role="presentation"> <a role="menuitem" lang="de" >Deutsch</a> </li> <li role="presentation"> <a role="menuitem" lang="es_419" >Español – América Latina</a> </li> <li role="presentation"> <a role="menuitem" lang="fr" >Français</a> </li> <li role="presentation"> <a role="menuitem" lang="id" >Indonesia</a> </li> <li role="presentation"> <a role="menuitem" lang="it" >Italiano</a> </li> <li role="presentation"> <a role="menuitem" lang="pt_br" >Português – Brasil</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_cn" >中文 – 简体</a> </li> <li role="presentation"> <a role="menuitem" lang="ja" >日本語</a> </li> <li role="presentation"> <a role="menuitem" lang="ko" >한국어</a> </li> </ul> </devsite-language-selector> </nav> </div> </devsite-footer-utility> <devsite-panel></devsite-panel> </section></section> <devsite-sitemask></devsite-sitemask> <devsite-snackbar></devsite-snackbar> <devsite-tooltip ></devsite-tooltip> <devsite-heading-link></devsite-heading-link> <devsite-analytics> <script type="application/json" analytics>[]</script> <script type="application/json" tag-management>{&#34;at&#34;: &#34;True&#34;, &#34;ga4&#34;: [], &#34;ga4p&#34;: [], &#34;gtm&#34;: [{&#34;id&#34;: &#34;GTM-5CVQBG&#34;, &#34;purpose&#34;: 1}], &#34;parameters&#34;: {&#34;internalUser&#34;: &#34;False&#34;, &#34;language&#34;: {&#34;machineTranslated&#34;: &#34;False&#34;, &#34;requested&#34;: &#34;en&#34;, &#34;served&#34;: &#34;en&#34;}, &#34;pageType&#34;: &#34;article&#34;, &#34;projectName&#34;: &#34;Cloud Storage&#34;, &#34;signedIn&#34;: &#34;False&#34;, &#34;tenant&#34;: &#34;cloud&#34;, &#34;recommendations&#34;: {&#34;sourcePage&#34;: &#34;&#34;, &#34;sourceType&#34;: 0, &#34;sourceRank&#34;: 0, &#34;sourceIdenticalDescriptions&#34;: 0, &#34;sourceTitleWords&#34;: 0, &#34;sourceDescriptionWords&#34;: 0, &#34;experiment&#34;: &#34;&#34;}, &#34;experiment&#34;: {&#34;ids&#34;: &#34;&#34;}}}</script> </devsite-analytics> <devsite-badger></devsite-badger> <cloudx-user></cloudx-user> <cloudx-free-trial-eligible-store freeTrialEligible='true'></cloudx-free-trial-eligible-store> <cloudx-pricing-socket></cloudx-pricing-socket> <cloudx-experiments type="TestAACodivertedExperiment" path="/virtual/TestAACodivertedExperiment/configureExperiment" location="SG" variant="variant2" ></cloudx-experiments> <cloudx-experiment-ids userCountry="SG" devsiteExperimentIdList="[39300012, 39300022, 39300118, 39300195, 39300251, 39300317, 39300320, 39300327, 39300345, 39300354, 39300363, 39300374, 39300412, 39300422, 39300436, 39300471, 39300487, 39300496, 39300498]"> </cloudx-experiment-ids> <script nonce="oh9H47nXf/lpf7BYQIzExGmjFl/fnG"> (function(d,e,v,s,i,t,E){d['GoogleDevelopersObject']=i; t=e.createElement(v);t.async=1;t.src=s;E=e.getElementsByTagName(v)[0]; E.parentNode.insertBefore(t,E);})(window, document, 'script', 'https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/js/app_loader.js', '[2,"en",null,"/js/devsite_app_module.js","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud","https://cloud-dot-devsite-v2-prod.appspot.com",null,null,["/_pwa/cloud/manifest.json","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/images/video-placeholder.svg","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/favicons/onecloud/favicon.ico","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/cloud/images/cloud-logo.svg","https://fonts.googleapis.com/css?family=Google+Sans:400,500,700|Google+Sans+Text:400,400italic,500,500italic,700,700italic|Roboto:400,400italic,500,500italic,700,700italic|Roboto+Mono:400,500,700&display=swap"],1,null,[1,6,8,12,14,17,21,25,50,52,63,70,75,76,80,87,91,92,93,97,98,100,101,102,103,104,105,107,108,109,110,112,113,116,117,118,120,122,124,125,126,127,129,130,131,132,133,134,135,136,138,140,141,147,148,149,151,152,156,157,158,159,161,163,164,168,169,170,179,180,182,183,186,191,193,196],"AIzaSyAP-jjEJBzmIyKR4F-3XITp8yM9T1gEEI8","AIzaSyB6xiKGDR5O3Ak2okS4rLkauxGUG7XP0hg","cloud.google.com","AIzaSyAQk0fBONSGUqCNznf6Krs82Ap1-NV6J4o","AIzaSyCCxcqdrZ_7QMeLCRY20bh_SXdAYqy70KY",null,null,null,["Profiles__enable_profile_collections","Profiles__enable_recognition_badges","Cloud__enable_cloud_shell_fte_user_flow","Search__enable_ai_search_summaries_restricted","Search__enable_page_map","Search__enable_suggestions_from_borg","Experiments__reqs_query_experiments","MiscFeatureFlags__enable_explain_this_code","Cloud__enable_cloud_facet_chat","Cloud__enable_cloud_shell","Profiles__require_profile_eligibility_for_signin","Search__enable_ai_search_summaries","MiscFeatureFlags__enable_variable_operator","MiscFeatureFlags__developers_footer_image","MiscFeatureFlags__emergency_css","Concierge__enable_concierge_restricted","Cloud__enable_cloudx_ping","Search__enable_dynamic_content_confidential_banner","EngEduTelemetry__enable_engedu_telemetry","Cloud__enable_cloudx_experiment_ids","Profiles__enable_developer_profiles_callout","Profiles__enable_release_notes_notifications","Concierge__enable_pushui","Profiles__enable_public_developer_profiles","Profiles__enable_page_saving","Profiles__enable_dashboard_curated_recommendations","Profiles__enable_awarding_url","Cloud__enable_free_trial_server_call","BookNav__enable_tenant_cache_key","Cloud__enable_llm_concierge_chat","CloudShell__cloud_code_overflow_menu","TpcFeatures__enable_mirror_tenant_redirects","CloudShell__cloud_shell_button","Profiles__enable_complete_playlist_endpoint","Search__enable_ai_eligibility_checks","TpcFeatures__enable_required_headers","MiscFeatureFlags__developers_footer_dark_image","Profiles__enable_completecodelab_endpoint","Search__scope_to_project_tenant","Cloud__enable_cloud_dlp_service","DevPro__enable_developer_subscriptions","Cloud__enable_legacy_calculator_redirect","MiscFeatureFlags__enable_firebase_utm","MiscFeatureFlags__enable_project_variables","Analytics__enable_clearcut_logging","MiscFeatureFlags__enable_view_transitions","DevPro__enable_cloud_innovators_plus"],null,null,"AIzaSyBLEMok-5suZ67qRPzx0qUtbnLmyT_kCVE","https://developerscontentserving-pa.clients6.google.com","AIzaSyCM4QpTRSqP5qI4Dvjt4OAScIN8sOUlO-k","https://developerscontentsearch-pa.clients6.google.com",1,4,1,"https://developerprofiles-pa.clients6.google.com",[2,"cloud","Google Cloud","cloud.google.com",null,"cloud-dot-devsite-v2-prod.appspot.com",null,null,[1,1,null,null,null,null,null,null,null,null,null,[1],null,null,null,null,null,1,[1],[null,null,null,[1,20],"/terms/recommendations"],[1],null,[1],[1,null,1],[1,1,null,null,1,null,["/vertex-ai/"]]],null,[22,null,null,null,null,null,"/images/cloud-logo.svg","/images/favicons/onecloud/apple-icon.png",null,null,null,null,1,1,1,[6,5],[],null,null,[[],[],[],[],[],[],[],[]],null,1,null,null,null,null,[]],[],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[6,1,14,15,22,23,29,37],null,[[null,null,null,null,null,null,[1,[["docType","Choose a content type",[["ApiReference",null,null,null,null,null,null,null,null,"API reference"],["Sample",null,null,null,null,null,null,null,null,"Code sample"],["ReferenceArchitecture",null,null,null,null,null,null,null,null,"Reference architecture"],["Tutorial",null,null,null,null,null,null,null,null,"Tutorial"]]],["category","Choose a topic",[["AiAndMachineLearning",null,null,null,null,null,null,null,null,"Artificial intelligence and machine learning (AI/ML)"],["ApplicationDevelopment",null,null,null,null,null,null,null,null,"Application development"],["BigDataAndAnalytics",null,null,null,null,null,null,null,null,"Big data and analytics"],["Compute",null,null,null,null,null,null,null,null,"Compute"],["Containers",null,null,null,null,null,null,null,null,"Containers"],["Databases",null,null,null,null,null,null,null,null,"Databases"],["HybridCloud",null,null,null,null,null,null,null,null,"Hybrid and multicloud"],["LoggingAndMonitoring",null,null,null,null,null,null,null,null,"Logging and monitoring"],["Migrations",null,null,null,null,null,null,null,null,"Migrations"],["Networking",null,null,null,null,null,null,null,null,"Networking"],["SecurityAndCompliance",null,null,null,null,null,null,null,null,"Security and compliance"],["Serverless",null,null,null,null,null,null,null,null,"Serverless"],["Storage",null,null,null,null,null,null,null,null,"Storage"]]]]]],[1],null,1],[[null,null,null,null,null,["GTM-5CVQBG"],null,null,null,null,null,[["GTM-5CVQBG",2]],1],null,null,null,null,null,1],"mwETRvWii0eU5NUYprb0Y9z5GVbc",4,null,null,null,null,null,null,null,null,null,null,null,null,null,"cloud.devsite.google"],null,"pk_live_5170syrHvgGVmSx9sBrnWtA5luvk9BwnVcvIi7HizpwauFG96WedXsuXh790rtij9AmGllqPtMLfhe2RSwD6Pn38V00uBCydV4m"]') </script> <devsite-a11y-announce></devsite-a11y-announce> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10