SFTP-Serverinformationen abrufen

In diesem Dokument wird beschrieben, wie Sie Informationen zu Ihren Cloud FTP-Servern abrufen. Sie können alle SFTP-Server in einem Projekt und an einem Standort auflisten. Sie können auch detaillierte Informationen zu einem bestimmten Server abrufen, z. B. den Status und die Verbindungsdetails.

Erforderliche Rollen

Bitten Sie Ihren Administrator, Ihnen die IAM-Rolle Cloud FTP Viewer (roles/ftp.viewer) für Ihr Projekt zuzuweisen, um die Berechtigungen zu erhalten, die Sie zum Abrufen von Informationen zu SFTP-Servern benötigen. Weitere Informationen zum Zuweisen von Rollen finden Sie unter Zugriff auf Projekte, Ordner und Organisationen verwalten.

Diese vordefinierte Rolle enthält die Berechtigungen, die zum Abrufen von Informationen zu SFTP-Servern erforderlich sind. Maximieren Sie den Abschnitt Erforderliche Berechtigungen, um die notwendigen Berechtigungen anzuzeigen:

Erforderliche Berechtigungen

Die folgenden Berechtigungen sind erforderlich, um Informationen zu SFTP-Servern abzurufen:

  • Server auflisten: ftp.servers.list
  • Rufen Sie die Serverdetails ab: ftp.servers.get

Sie können diese Berechtigungen auch mit benutzerdefinierten Rollen oder anderen vordefinierten Rollen erhalten.

Server auflisten

Console

  • Rufen Sie in der Google Cloud Console die Seite Cloud FTP auf.

    Zu Cloud FTP

    Eine Liste der Server wird angezeigt.

gcloud

Führen Sie den Befehl gcloud alpha storage ftp servers list aus, um SFTP-Server aufzulisten.

Ersetzen Sie folgende Werte, bevor sie einen der Befehlsdaten verwenden:

  • LOCATION_ID: der Standort des Servers, z. B. us-west1.

Führen Sie folgenden Befehl aus:

Linux, macOS oder Cloud Shell

gcloud alpha storage ftp servers list --location=LOCATION_ID

Windows (PowerShell)

gcloud alpha storage ftp servers list --location=LOCATION_ID

Windows (cmd.exe)

gcloud alpha storage ftp servers list --location=LOCATION_ID

REST

Verwenden Sie die Methode servers.list, um SFTP-Server aufzulisten.

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • PROJECT_ID: die Projekt-ID von Google Cloud .
  • LOCATION_ID: der Standort des Servers, z. B. us-west1.

HTTP-Methode und URL:

GET https://ftp.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/servers

Wenn Sie die Anfrage senden möchten, maximieren Sie eine der folgenden Optionen:

Der Antworttext ist ein JSON-Objekt mit einer Liste von Server-Ressourcen.

Clientbibliotheken

C#

Informationen zum Installieren und Verwenden der Clientbibliothek für Cloud FTP finden Sie unter Cloud FTP-Clientbibliotheken. Weitere Informationen finden Sie in der API-Referenzdokumentation zu Cloud FTP C#.

Richten Sie die Standardanmeldedaten für Anwendungen ein, um sich bei Cloud FTP zu authentifizieren. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

using Google.Api.Gax;
using Google.Cloud.Ftp.V1;
using System;
using System.Threading.Tasks;

public sealed partial class GeneratedCloudFtpClientSnippets
{
    /// <summary>Snippet for ListServersAsync</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public async Task ListServersAsync()
    {
        // Create client
        CloudFtpClient cloudFtpClient = await CloudFtpClient.CreateAsync();
        // Initialize request argument(s)
        string parent = "projects/[PROJECT]/locations/[LOCATION]";
        // Make the request
        PagedAsyncEnumerable<ListServersResponse, Server> response = cloudFtpClient.ListServersAsync(parent);

        // Iterate over all response items, lazily performing RPCs as required
        await foreach (Server item in response)
        {
            // Do something with each item
            Console.WriteLine(item);
        }

        // Or iterate over pages (of server-defined size), performing one RPC per page
        await foreach (ListServersResponse page in response.AsRawResponses())
        {
            // Do something with each page of items
            Console.WriteLine("A page of results:");
            foreach (Server item in page)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
        }

        // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
        int pageSize = 10;
        Page<Server> singlePage = await response.ReadPageAsync(pageSize);
        // Do something with the page of items
        Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
        foreach (Server item in singlePage)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
        // Store the pageToken, for when the next page is required.
        string nextPageToken = singlePage.NextPageToken;
    }
}

Go

Informationen zum Installieren und Verwenden der Clientbibliothek für Cloud FTP finden Sie unter Cloud FTP-Clientbibliotheken. Weitere Informationen finden Sie in der API-Referenzdokumentation zu Cloud FTP Go.

Richten Sie die Standardanmeldedaten für Anwendungen ein, um sich bei Cloud FTP zu authentifizieren. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.


//go:build examples

package main

import (
	"context"

	ftp "cloud.google.com/go/ftp/apiv1"
	ftppb "cloud.google.com/go/ftp/apiv1/ftppb"
	"google.golang.org/api/iterator"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := ftp.NewCloudFtpRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &ftppb.ListServersRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#ListServersRequest.
	}
	it := c.ListServers(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*ftppb.ListServersResponse)
	}
}

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Cloud FTP finden Sie unter Cloud FTP-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Cloud FTP Java API.

Richten Sie die Standardanmeldedaten für Anwendungen ein, um sich bei Cloud FTP zu authentifizieren. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

import com.google.api.core.ApiFuture;
import com.google.cloud.ftp.v1.CloudFtpClient;
import com.google.cloud.ftp.v1.ListServersRequest;
import com.google.cloud.ftp.v1.LocationName;
import com.google.cloud.ftp.v1.Server;
import com.google.cloud.ftp.v1.ServerView;

public class AsyncListServers {

  public static void main(String[] args) throws Exception {
    asyncListServers();
  }

  public static void asyncListServers() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CloudFtpClient cloudFtpClient = CloudFtpClient.create()) {
      ListServersRequest request =
          ListServersRequest.newBuilder()
              .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
              .setPageSize(883849137)
              .setPageToken("pageToken873572522")
              .setFilter("filter-1274492040")
              .setOrderBy("orderBy-1207110587")
              .setView(ServerView.forNumber(0))
              .build();
      ApiFuture<Server> future = cloudFtpClient.listServersPagedCallable().futureCall(request);
      // Do something.
      for (Server element : future.get().iterateAll()) {
        // doThingsWith(element);
      }
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Cloud FTP finden Sie unter Cloud FTP-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Cloud FTP Node.js API.

Richten Sie die Standardanmeldedaten für Anwendungen ein, um sich bei Cloud FTP zu authentifizieren. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. Parent value for ListServersRequest
 */
// const parent = 'abc123'
/**
 *  Optional. Requested page size. Server may return fewer items than
 *  requested. If unspecified, server will pick an appropriate default.
 */
// const pageSize = 1234
/**
 *  Optional. A token identifying a page of results the server should return.
 */
// const pageToken = 'abc123'
/**
 *  Optional. Filtering results
 */
// const filter = 'abc123'
/**
 *  Optional. Hint for how to order the results
 */
// const orderBy = 'abc123'
/**
 *  Optional. The view of the Server resource to return.
 */
// const view = {}

// Imports the Ftp library
const {CloudFtpClient} = require('@google-cloud/ftp').v1;

// Instantiates a client
const ftpClient = new CloudFtpClient();

async function callListServers() {
  // Construct request
  const request = {
    parent,
  };

  // Run request
  const iterable = ftpClient.listServersAsync(request);
  for await (const response of iterable) {
      console.log(response);
  }
}

callListServers();

PHP

Informationen zum Installieren und Verwenden der Clientbibliothek für Cloud FTP finden Sie unter Cloud FTP-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Cloud FTP PHP API.

Richten Sie die Standardanmeldedaten für Anwendungen ein, um sich bei Cloud FTP zu authentifizieren. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Ftp\V1\Client\CloudFtpClient;
use Google\Cloud\Ftp\V1\ListServersRequest;

/**
 * Lists Servers in a given project and location.
 *
 * @param string $formattedParent Parent value for ListServersRequest
 *                                Please see {@see CloudFtpClient::locationName()} for help formatting this field.
 */
function list_servers_sample(string $formattedParent): void
{
    // Create a client.
    $cloudFtpClient = new CloudFtpClient();

    // Prepare the request message.
    $request = (new ListServersRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $cloudFtpClient->listServers($request);

        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = CloudFtpClient::locationName('[PROJECT]', '[LOCATION]');

    list_servers_sample($formattedParent);
}

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Cloud FTP finden Sie unter Cloud FTP-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Cloud FTP Python API.

Richten Sie die Standardanmeldedaten für Anwendungen ein, um sich bei Cloud FTP zu authentifizieren. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import ftp_v1


def sample_list_servers():
    # Create a client
    client = ftp_v1.CloudFtpClient()

    # Initialize request argument(s)
    request = ftp_v1.ListServersRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_servers(request=request)

    # Handle the response
    for response in page_result:
        print(response)

Ruby

Informationen zum Installieren und Verwenden der Clientbibliothek für Cloud FTP finden Sie unter Cloud FTP-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Cloud FTP Ruby API.

Richten Sie die Standardanmeldedaten für Anwendungen ein, um sich bei Cloud FTP zu authentifizieren. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

require "google/cloud/ftp/v1"

##
# Snippet for the list_servers call in the CloudFtp service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Ftp::V1::CloudFtp::Rest::Client#list_servers.
#
def list_servers
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Ftp::V1::CloudFtp::Rest::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Ftp::V1::ListServersRequest.new

  # Call the list_servers method.
  result = client.list_servers request

  # The returned object is of type Gapic::PagedEnumerable. You can iterate
  # over elements, and API calls will be issued to fetch pages as needed.
  result.each do |item|
    # Each element is of type ::Google::Cloud::Ftp::V1::Server.
    p item
  end
end

Details zu einem Server abrufen

So rufen Sie detaillierte Informationen zu einem bestimmten Server ab, einschließlich der IP-Adresse oder des Dienstanhangs, des Status, der Anmeldedaten und der E-Mail-Adresse des Dienst-Agents:

Console

  1. Rufen Sie in der Google Cloud Console die Seite Cloud FTP auf.

    Zu Cloud FTP

  2. Klicken Sie auf den Servernamen.

gcloud

Führen Sie den Befehl gcloud alpha storage ftp servers describe aus, um Details zu einem SFTP-Server abzurufen.

Ersetzen Sie folgende Werte, bevor sie einen der Befehlsdaten verwenden:

  • SERVER_ID: die SFTP-Server-ID.
  • LOCATION_ID: der Standort des Servers, z. B. us-west1.

Führen Sie folgenden Befehl aus:

Linux, macOS oder Cloud Shell

gcloud alpha storage ftp servers describe SERVER_ID --location=LOCATION_ID

Windows (PowerShell)

gcloud alpha storage ftp servers describe SERVER_ID --location=LOCATION_ID

Windows (cmd.exe)

gcloud alpha storage ftp servers describe SERVER_ID --location=LOCATION_ID

REST

Wenn Sie Details zu einem SFTP-Server abrufen möchten, verwenden Sie die Methode servers.get.

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • PROJECT_ID: die Projekt-ID von Google Cloud .
  • LOCATION_ID: der Standort des Servers, z. B. us-west1.
  • SERVER_ID: die SFTP-Server-ID.

HTTP-Methode und URL:

GET https://ftp.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/servers/SERVER_ID

Wenn Sie die Anfrage senden möchten, maximieren Sie eine der folgenden Optionen:

Der Antworttext ist eine Server-Ressource.

Clientbibliotheken

C#

Informationen zum Installieren und Verwenden der Clientbibliothek für Cloud FTP finden Sie unter Cloud FTP-Clientbibliotheken. Weitere Informationen finden Sie in der API-Referenzdokumentation zu Cloud FTP C#.

Richten Sie die Standardanmeldedaten für Anwendungen ein, um sich bei Cloud FTP zu authentifizieren. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

using Google.Cloud.Ftp.V1;
using System.Threading.Tasks;

public sealed partial class GeneratedCloudFtpClientSnippets
{
    /// <summary>Snippet for GetServerAsync</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public async Task GetServerAsync()
    {
        // Create client
        CloudFtpClient cloudFtpClient = await CloudFtpClient.CreateAsync();
        // Initialize request argument(s)
        string name = "projects/[PROJECT]/locations/[LOCATION]/servers/[SERVER]";
        // Make the request
        Server response = await cloudFtpClient.GetServerAsync(name);
    }
}

Go

Informationen zum Installieren und Verwenden der Clientbibliothek für Cloud FTP finden Sie unter Cloud FTP-Clientbibliotheken. Weitere Informationen finden Sie in der Referenzdokumentation zur Cloud FTP Go API.

Richten Sie die Standardanmeldedaten für Anwendungen ein, um sich bei Cloud FTP zu authentifizieren. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.


//go:build examples

package main

import (
	"context"

	ftp "cloud.google.com/go/ftp/apiv1"
	ftppb "cloud.google.com/go/ftp/apiv1/ftppb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := ftp.NewCloudFtpRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &ftppb.GetServerRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#GetServerRequest.
	}
	resp, err := c.GetServer(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Informationen zum Installieren und Verwenden der Clientbibliothek für Cloud FTP finden Sie unter Cloud FTP-Clientbibliotheken. Weitere Informationen finden Sie in der API-Referenzdokumentation zu Cloud FTP Java.

Richten Sie die Standardanmeldedaten für Anwendungen ein, um sich bei Cloud FTP zu authentifizieren. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

import com.google.api.core.ApiFuture;
import com.google.cloud.ftp.v1.CloudFtpClient;
import com.google.cloud.ftp.v1.GetServerRequest;
import com.google.cloud.ftp.v1.Server;
import com.google.cloud.ftp.v1.ServerName;
import com.google.cloud.ftp.v1.ServerView;

public class AsyncGetServer {

  public static void main(String[] args) throws Exception {
    asyncGetServer();
  }

  public static void asyncGetServer() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CloudFtpClient cloudFtpClient = CloudFtpClient.create()) {
      GetServerRequest request =
          GetServerRequest.newBuilder()
              .setName(ServerName.of("[PROJECT]", "[LOCATION]", "[SERVER]").toString())
              .setView(ServerView.forNumber(0))
              .build();
      ApiFuture<Server> future = cloudFtpClient.getServerCallable().futureCall(request);
      // Do something.
      Server response = future.get();
    }
  }
}

Node.js

Informationen zum Installieren und Verwenden der Clientbibliothek für Cloud FTP finden Sie unter Cloud FTP-Clientbibliotheken. Weitere Informationen finden Sie in der API-Referenzdokumentation zu Cloud FTP Node.js.

Richten Sie die Standardanmeldedaten für Anwendungen ein, um sich bei Cloud FTP zu authentifizieren. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. Name of the resource
 */
// const name = 'abc123'
/**
 *  Optional. The view of the Server resource to return.
 */
// const view = {}

// Imports the Ftp library
const {CloudFtpClient} = require('@google-cloud/ftp').v1;

// Instantiates a client
const ftpClient = new CloudFtpClient();

async function callGetServer() {
  // Construct request
  const request = {
    name,
  };

  // Run request
  const response = await ftpClient.getServer(request);
  console.log(response);
}

callGetServer();

PHP

Informationen zum Installieren und Verwenden der Clientbibliothek für Cloud FTP finden Sie unter Cloud FTP-Clientbibliotheken. Weitere Informationen finden Sie in der API-Referenzdokumentation zu Cloud FTP PHP.

Richten Sie die Standardanmeldedaten für Anwendungen ein, um sich bei Cloud FTP zu authentifizieren. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

use Google\ApiCore\ApiException;
use Google\Cloud\Ftp\V1\Client\CloudFtpClient;
use Google\Cloud\Ftp\V1\GetServerRequest;
use Google\Cloud\Ftp\V1\Server;

/**
 * Gets details of a single Server.
 *
 * @param string $formattedName Name of the resource
 *                              Please see {@see CloudFtpClient::serverName()} for help formatting this field.
 */
function get_server_sample(string $formattedName): void
{
    // Create a client.
    $cloudFtpClient = new CloudFtpClient();

    // Prepare the request message.
    $request = (new GetServerRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Server $response */
        $response = $cloudFtpClient->getServer($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = CloudFtpClient::serverName('[PROJECT]', '[LOCATION]', '[SERVER]');

    get_server_sample($formattedName);
}

Python

Informationen zum Installieren und Verwenden der Clientbibliothek für Cloud FTP finden Sie unter Cloud FTP-Clientbibliotheken. Weitere Informationen finden Sie in der API-Referenzdokumentation zu Cloud FTP Python.

Richten Sie die Standardanmeldedaten für Anwendungen ein, um sich bei Cloud FTP zu authentifizieren. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import ftp_v1


def sample_get_server():
    # Create a client
    client = ftp_v1.CloudFtpClient()

    # Initialize request argument(s)
    request = ftp_v1.GetServerRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_server(request=request)

    # Handle the response
    print(response)

Ruby

Informationen zum Installieren und Verwenden der Clientbibliothek für Cloud FTP finden Sie unter Cloud FTP-Clientbibliotheken. Weitere Informationen finden Sie in der API-Referenzdokumentation zu Cloud FTP Ruby.

Richten Sie die Standardanmeldedaten für Anwendungen ein, um sich bei Cloud FTP zu authentifizieren. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

require "google/cloud/ftp/v1"

##
# Snippet for the get_server call in the CloudFtp service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Ftp::V1::CloudFtp::Rest::Client#get_server.
#
def get_server
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Ftp::V1::CloudFtp::Rest::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Ftp::V1::GetServerRequest.new

  # Call the get_server method.
  result = client.get_server request

  # The returned object is of type Google::Cloud::Ftp::V1::Server.
  p result
end