blob: 2f6a3527831c3448bb6712fe7e752dc2acd8a45c [file] [log] [blame]
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>apache_beam.io.gcp.gcsio module &mdash; Apache Beam 2.67.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=b86133f3" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=959b4fbe"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="apache_beam.io.gcp.gcsio_retry module" href="apache_beam.io.gcp.gcsio_retry.html" />
<link rel="prev" title="apache_beam.io.gcp.gcsfilesystem module" href="apache_beam.io.gcp.gcsfilesystem.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home">
Apache Beam
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="apache_beam.coders.html">apache_beam.coders package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.dataframe.html">apache_beam.dataframe package</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="apache_beam.io.html">apache_beam.io package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="apache_beam.io.html#subpackages">Subpackages</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="apache_beam.io.aws.html">apache_beam.io.aws package</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.io.azure.html">apache_beam.io.azure package</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.io.components.html">apache_beam.io.components package</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.io.external.html">apache_beam.io.external package</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.io.flink.html">apache_beam.io.flink package</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="apache_beam.io.gcp.html">apache_beam.io.gcp package</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="apache_beam.io.gcp.html#subpackages">Subpackages</a></li>
<li class="toctree-l4 current"><a class="reference internal" href="apache_beam.io.gcp.html#submodules">Submodules</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="apache_beam.io.html#submodules">Submodules</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.metrics.html">apache_beam.metrics package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.ml.html">apache_beam.ml package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.options.html">apache_beam.options package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.portability.html">apache_beam.portability package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.runners.html">apache_beam.runners package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.testing.html">apache_beam.testing package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.transforms.html">apache_beam.transforms package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.typehints.html">apache_beam.typehints package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.utils.html">apache_beam.utils package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.yaml.html">apache_beam.yaml package</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.error.html">apache_beam.error module</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.pipeline.html">apache_beam.pipeline module</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.pvalue.html">apache_beam.pvalue module</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Apache Beam</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="apache_beam.io.html">apache_beam.io package</a></li>
<li class="breadcrumb-item"><a href="apache_beam.io.gcp.html">apache_beam.io.gcp package</a></li>
<li class="breadcrumb-item active">apache_beam.io.gcp.gcsio module</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/apache_beam.io.gcp.gcsio.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="module-apache_beam.io.gcp.gcsio">
<span id="apache-beam-io-gcp-gcsio-module"></span><h1>apache_beam.io.gcp.gcsio module<a class="headerlink" href="#module-apache_beam.io.gcp.gcsio" title="Link to this heading"></a></h1>
<p>Google Cloud Storage client.</p>
<p>This library evolved from the Google App Engine GCS client available at
<a class="reference external" href="https://github.com/GoogleCloudPlatform/appengine-gcs-client">https://github.com/GoogleCloudPlatform/appengine-gcs-client</a>.</p>
<p><strong>Updates to the I/O connector code</strong></p>
<p>For any significant updates to this I/O connector, please consider involving
corresponding code reviewers mentioned in
<a class="reference external" href="https://github.com/apache/beam/blob/master/sdks/python/OWNERS">https://github.com/apache/beam/blob/master/sdks/python/OWNERS</a></p>
<dl class="py class">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">apache_beam.io.gcp.gcsio.</span></span><span class="sig-name descname"><span class="pre">GcsIO</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">storage_client</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Client</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pipeline_options</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><span class="pre">dict</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="apache_beam.options.pipeline_options.html#apache_beam.options.pipeline_options.PipelineOptions" title="apache_beam.options.pipeline_options.PipelineOptions"><span class="pre">PipelineOptions</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO" title="Link to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.13)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>Google Cloud Storage I/O client.</p>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.get_project_number">
<span class="sig-name descname"><span class="pre">get_project_number</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">bucket</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.get_project_number"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.get_project_number" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.get_bucket">
<span class="sig-name descname"><span class="pre">get_bucket</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">bucket_name</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.get_bucket"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.get_bucket" title="Link to this definition"></a></dt>
<dd><p>Returns an object bucket from its name, or None if it does not exist.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.create_bucket">
<span class="sig-name descname"><span class="pre">create_bucket</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">bucket_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">project</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">kms_key</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">location</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">soft_delete_retention_duration_seconds</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.create_bucket"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.create_bucket" title="Link to this definition"></a></dt>
<dd><p>Create and return a GCS bucket in a specific project.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.open">
<span class="sig-name descname"><span class="pre">open</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filename</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mode</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'r'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">read_buffer_size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">16777216</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mime_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'application/octet-stream'</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.open"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.open" title="Link to this definition"></a></dt>
<dd><p>Open a GCS file path for reading or writing.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – GCS file path in the form <code class="docutils literal notranslate"><span class="pre">gs://&lt;bucket&gt;/&lt;object&gt;</span></code>.</p></li>
<li><p><strong>mode</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – <code class="docutils literal notranslate"><span class="pre">'r'</span></code> for reading or <code class="docutils literal notranslate"><span class="pre">'w'</span></code> for writing.</p></li>
<li><p><strong>read_buffer_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – Buffer size to use during read operations.</p></li>
<li><p><strong>mime_type</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – Mime type to set for write operations.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>GCS file object.</p>
</dd>
<dt class="field-odd">Raises<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#ValueError" title="(in Python v3.13)"><strong>ValueError</strong></a> – Invalid open file mode.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.delete">
<span class="sig-name descname"><span class="pre">delete</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">recursive</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.delete"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.delete" title="Link to this definition"></a></dt>
<dd><p>Deletes the object at the given GCS path.</p>
<p>If the path is a directory (prefix), it deletes all blobs under that prefix
when recursive=True.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>path</strong> – GCS file path pattern in the form gs://&lt;bucket&gt;/&lt;name&gt;.</p></li>
<li><p><strong>recursive</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.13)"><em>bool</em></a><em>, </em><em>optional</em>) – If True, deletes all objects under the prefix
when the path is a directory (default: False).</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.delete_batch">
<span class="sig-name descname"><span class="pre">delete_batch</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">paths</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.delete_batch"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.delete_batch" title="Link to this definition"></a></dt>
<dd><p>Deletes the objects at the given GCS paths.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>paths</strong> – List of GCS file path patterns or Dict with GCS file path patterns
as keys. The patterns are in the form gs://&lt;bucket&gt;/&lt;name&gt;, but
not to exceed MAX_BATCH_OPERATION_SIZE in length.</p>
</dd>
</dl>
<dl class="simple">
<dt>Returns: List of tuples of (path, exception) in the same order as the</dt><dd><p>paths argument, where exception is None if the operation
succeeded or the relevant exception if the operation failed.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.copy">
<span class="sig-name descname"><span class="pre">copy</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">src</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dest</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.copy"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.copy" title="Link to this definition"></a></dt>
<dd><p>Copies the given GCS object from src to dest.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>src</strong> – GCS file path pattern in the form gs://&lt;bucket&gt;/&lt;name&gt;.</p></li>
<li><p><strong>dest</strong> – GCS file path pattern in the form gs://&lt;bucket&gt;/&lt;name&gt;.</p></li>
</ul>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>Any exceptions during copying</strong></p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.copy_batch">
<span class="sig-name descname"><span class="pre">copy_batch</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">src_dest_pairs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.copy_batch"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.copy_batch" title="Link to this definition"></a></dt>
<dd><p>Copies the given GCS objects from src to dest.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>src_dest_pairs</strong> – list of (src, dest) tuples of gs://&lt;bucket&gt;/&lt;name&gt; files
paths to copy from src to dest, not to exceed
MAX_BATCH_OPERATION_SIZE in length.</p>
</dd>
</dl>
<dl class="simple">
<dt>Returns: List of tuples of (src, dest, exception) in the same order as the</dt><dd><p>src_dest_pairs argument, where exception is None if the operation
succeeded or the relevant exception if the operation failed.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.copytree">
<span class="sig-name descname"><span class="pre">copytree</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">src</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dest</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.copytree"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.copytree" title="Link to this definition"></a></dt>
<dd><p>Renames the given GCS “directory” recursively from src to dest.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>src</strong> – GCS file path pattern in the form gs://&lt;bucket&gt;/&lt;name&gt;/.</p></li>
<li><p><strong>dest</strong> – GCS file path pattern in the form gs://&lt;bucket&gt;/&lt;name&gt;/.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.rename">
<span class="sig-name descname"><span class="pre">rename</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">src</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dest</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.rename"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.rename" title="Link to this definition"></a></dt>
<dd><p>Renames the given GCS object from src to dest.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>src</strong> – GCS file path pattern in the form gs://&lt;bucket&gt;/&lt;name&gt;.</p></li>
<li><p><strong>dest</strong> – GCS file path pattern in the form gs://&lt;bucket&gt;/&lt;name&gt;.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.exists">
<span class="sig-name descname"><span class="pre">exists</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.exists"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.exists" title="Link to this definition"></a></dt>
<dd><p>Returns whether the given GCS object exists.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>path</strong> – GCS file path pattern in the form gs://&lt;bucket&gt;/&lt;name&gt;.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.checksum">
<span class="sig-name descname"><span class="pre">checksum</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.checksum"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.checksum" title="Link to this definition"></a></dt>
<dd><p>Looks up the checksum of a GCS object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>path</strong> – GCS file path pattern in the form gs://&lt;bucket&gt;/&lt;name&gt;.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.size">
<span class="sig-name descname"><span class="pre">size</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.size"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.size" title="Link to this definition"></a></dt>
<dd><p>Returns the size of a single GCS object.</p>
<p>This method does not perform glob expansion. Hence the given path must be
for a single GCS object.</p>
<p>Returns: size of the GCS object in bytes.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.kms_key">
<span class="sig-name descname"><span class="pre">kms_key</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.kms_key"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.kms_key" title="Link to this definition"></a></dt>
<dd><p>Returns the KMS key of a single GCS object.</p>
<p>This method does not perform glob expansion. Hence the given path must be
for a single GCS object.</p>
<dl class="simple">
<dt>Returns: KMS key name of the GCS object as a string, or None if it doesn’t</dt><dd><p>have one.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.last_updated">
<span class="sig-name descname"><span class="pre">last_updated</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.last_updated"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.last_updated" title="Link to this definition"></a></dt>
<dd><p>Returns the last updated epoch time of a single GCS object.</p>
<p>This method does not perform glob expansion. Hence the given path must be
for a single GCS object.</p>
<p>Returns: last updated time of the GCS object in second.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.list_prefix">
<span class="sig-name descname"><span class="pre">list_prefix</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">with_metadata</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.list_prefix"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.list_prefix" title="Link to this definition"></a></dt>
<dd><p>Lists files matching the prefix.</p>
<blockquote>
<div><p><code class="docutils literal notranslate"><span class="pre">list_prefix</span></code> has been deprecated. Use <cite>list_files</cite> instead, which returns
a generator of file information instead of a dict.</p>
<dl class="simple">
<dt>Args:</dt><dd><p>path: GCS file path pattern in the form gs://&lt;bucket&gt;/[name].
with_metadata: Experimental. Specify whether returns file metadata.</p>
</dd>
<dt>Returns:</dt><dd><dl class="simple">
<dt>If <code class="docutils literal notranslate"><span class="pre">with_metadata</span></code> is False: dict of file name -&gt; size; if</dt><dd><p><code class="docutils literal notranslate"><span class="pre">with_metadata</span></code> is True: dict of file name -&gt; tuple(size, timestamp).</p>
</dd>
</dl>
</dd>
</dl>
</div></blockquote>
<div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version list_prefix: </span>is deprecated since 2.45.0. Use list_files instead.</p>
</div>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.list_files">
<span class="sig-name descname"><span class="pre">list_files</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">with_metadata</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.list_files"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.list_files" title="Link to this definition"></a></dt>
<dd><p>Lists files matching the prefix.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>path</strong> – GCS file path pattern in the form gs://&lt;bucket&gt;/[name].</p></li>
<li><p><strong>with_metadata</strong> – Experimental. Specify whether returns file metadata.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>generator of tuple(file name, size); if
<code class="docutils literal notranslate"><span class="pre">with_metadata</span></code> is True: generator of
tuple(file name, tuple(size, timestamp)).</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p>If <code class="docutils literal notranslate"><span class="pre">with_metadata</span></code> is False</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.GcsIO.is_soft_delete_enabled">
<span class="sig-name descname"><span class="pre">is_soft_delete_enabled</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">gcs_path</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#GcsIO.is_soft_delete_enabled"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.GcsIO.is_soft_delete_enabled" title="Link to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="apache_beam.io.gcp.gcsio.create_storage_client">
<span class="sig-prename descclassname"><span class="pre">apache_beam.io.gcp.gcsio.</span></span><span class="sig-name descname"><span class="pre">create_storage_client</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pipeline_options</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">use_credentials</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/gcp/gcsio.html#create_storage_client"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.gcp.gcsio.create_storage_client" title="Link to this definition"></a></dt>
<dd><p>Create a GCS client for Beam via GCS Client Library.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>pipeline_options</strong> (<a class="reference internal" href="apache_beam.options.pipeline_options.html#apache_beam.options.pipeline_options.PipelineOptions" title="apache_beam.options.pipeline_options.PipelineOptions"><em>apache_beam.options.pipeline_options.PipelineOptions</em></a>) – the options of the pipeline.</p></li>
<li><p><strong>use_credentials</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.13)"><em>bool</em></a>) – whether to create an authenticated client based
on pipeline options or an anonymous client.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>A google.cloud.storage.client.Client instance.</p>
</dd>
</dl>
</dd></dl>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="apache_beam.io.gcp.gcsfilesystem.html" class="btn btn-neutral float-left" title="apache_beam.io.gcp.gcsfilesystem module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="apache_beam.io.gcp.gcsio_retry.html" class="btn btn-neutral float-right" title="apache_beam.io.gcp.gcsio_retry module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright %Y, Apache Beam.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>