עדכון של דליים למשתמש SFTP

במאמר הזה מוסבר איך לעדכן את הקטגוריות של Cloud Storage למשתמש ב-Cloud FTP, כולל הקטגוריות שאליהן המשתמש יכול לגשת וההרשאות שיש למשתמש.

ככלל, אלה השלבים לעדכון הקטגוריות של משתמש:

  1. מעדכנים את התפקידים ב-IAM של חשבון השירות של המשתמש.
  2. ממפים את הספריות של המשתמש לקטגוריות המעודכנות.

לפני שמתחילים

התפקידים הנדרשים

כדי לקבל את ההרשאה שנדרשת לעדכון משתמשי SFTP, צריך לבקש מהאדמין להקצות לכם ב-IAM את התפקיד אדמין FTP (roles/ftp.admin) בפרויקט. כדי לקרוא הסבר על מתן תפקידים, ראו איך מנהלים את הגישה ברמת הפרויקט, התיקייה והארגון.

התפקיד המוגדר מראש הזה כולל את ההרשאה ftp.users.update, שנדרשת כדי לעדכן משתמשי SFTP.

יכול להיות שתוכלו לקבל את ההרשאה הזו גם בתפקידים בהתאמה אישית או בתפקידים מוגדרים מראש.

עדכון תפקידי IAM לחשבון שירות של משתמש

אם משנים את הדליים שהמשתמש יכול לגשת אליהם, או אם משנים את ההרשאה שיש למשתמש למיפוי קיים של ספרייה, צריך לעדכן את חשבון השירות של המשתמש בתפקידים הרלוונטיים ב-IAM. מבצעים את הפעולות הבאות:

  1. משיגים את כתובת האימייל של חשבון השירות של המשתמש. איך מקבלים פרטים על משתמש?

  2. אם מוסיפים קטגוריות חדשות למיפוי הספריות או מגדילים את הגישה לקטגוריות קיימות, צריך לבצע את הפעולות הבאות:

    1. מקצים לעצמכם את התפקיד 'צפייה בקטגוריית אחסון' (roles/storage.bucketViewer) בקטגוריה, אם התפקיד עדיין לא הוקצה לכם:

      gcloud storage buckets add-iam-policy-binding gs://BUCKET_NAME \
          --member="user:ADMINISTRATOR_EMAIL" \
          --role="roles/storage.bucketViewer"

      מחליפים את מה שכתוב בשדות הבאים:

      • ‫ADMINISTRATOR_EMAIL: כתובת האימייל של הגורם הראשי שיוצר את משתמש ה-SFTP. אם אתם יוצרים את המשתמש (בניגוד לאפליקציה), הערך הזה הוא כתובת האימייל שבה אתם משתמשים כדי לגשת אל Google Cloud.

      • ‫BUCKET_NAME: שם הקטגוריה.

    2. אם עדיין לא הוקצה לכם התפקיד "צפייה באובייקט אחסון" (roles/storage.objectViewer) בקטגוריה, הקצו אותו לעצמכם:

      gcloud storage buckets add-iam-policy-binding gs://BUCKET_NAME \
          --member="user:ADMINISTRATOR_EMAIL" \
          --role="roles/storage.objectViewer"
    3. מקצים לחשבון השירות של המשתמש את תפקידי ה-IAM שנדרשים לגישה למאגרי המידע:

      gcloud storage buckets add-iam-policy-binding gs://BUCKET_NAME \
        --member="serviceAccount:SERVICE_ACCOUNT" \
        --role="ROLE_TO_GRANT"

      מחליפים את מה שכתוב בשדות הבאים:

      • ‫SERVICE_ACCOUNT: כתובת האימייל של חשבון השירות של המשתמש.
      • ‫ROLE_TO_GRANT: תפקיד ה-IAM שרוצים להקצות. מציינים אחד מהתפקידים הבאים:

        • כדי לקבל גישה לקריאה בלבד, משתמשים בתפקיד roles/storage.objectViewer.
        • כדי לקבל גישת קריאה וכתיבה, צריך להשתמש בתפקיד roles/storage.objectAdmin.
    4. חוזרים על השלבים הקודמים לכל מאגר שהמשתמש צריך לגשת אליו.

  3. אם מסירים מאגרי מידע ממיפוי הספריות או מצמצמים את הגישה למאגרי מידע קיימים, צריך לבטל את הגישה מחשבון השירות של המשתמש:

    gcloud storage buckets remove-iam-policy-binding gs://BUCKET_NAME \
      --member="serviceAccount:SERVICE_ACCOUNT" \
      --role="ROLE_TO_REVOKE"

    מחליפים את ROLE_TO_REVOKE בתפקיד ב-IAM שרוצים לבטל.

    חוזרים על השלב הזה לכל דלי ולכל תפקיד IAM שהמשתמש לא אמור יותר לקבל גישה אליהם.

עדכון הקטגוריות של המשתמש

gcloud

כדי לעדכן את הקטגוריות של משתמש SFTP, מריצים את הפקודה gcloud alpha storage ftp users update.

לפני השימוש בנתוני הפקודה הבאים, צריך להחליף את הנתונים הבאים:

  • ‫USERNAME: שם המשתמש של משתמש ה-SFTP.
  • ‫LOCATION_ID: המיקום של השרת, למשל us-west1.
  • ‫SERVER_ID: מזהה השרת.
  • ‫BUCKET_NAME: השם של מאגר (bucket) שלמשתמש ה-SFTP יש גישה אליו, למשל example-bucket. השמיטו את gs://.
  • (אופציונלי) BUCKET_PREFIX: הנתיב של תיקייה בתוך הקטגוריה שרוצים להגדיר כתיקיית השורש של מיפוי התיקיות הזה. אם משמיטים את המאפיין bucket_prefix, אז Cloud FTP משתמש בתיקיית השורש של הקטגוריה.
  • ‫DIRECTORY: הנתיב של ספריית הנחיתה הלוגית שמוצג למשתמש ה-SFTP. לדוגמה, /home/uploads.

    אם ממפים כמה דליים או תיקיות, צריך לספק נתיב ייחודי לספרייה לכל מיפוי.

    אין תמיכה בספריות לוגיות מקוננות. אם מספקים כמה מיפויים לספרייה, צריך לספק את הספריות במבנה שטוח במקום במבנה בתצוגת עץ. לדוגמה, השתמשו ב-/dir1 וב-/dir2 במקום ב-/dir1 וב-/dir1/dir2.

  • ‫SFTP_PERMISSION: רמת הגישה לספרייה. כדי להגדיר הרשאת קריאה בלבד, צריך להגדיר את הערך הזה בתור READ_ONLY. כדי לקבל גישת קריאה וכתיבה, צריך להגדיר את הערך הזה ל-READ_WRITE.

כדי להעניק למשתמש גישה לכמה מאגרי מידע, צריך לציין את הדגל --storage-directory-mapping כמה פעמים, עם מיפוי ספריות לכל מאגר מידע.

מריצים את הפקודה הבאה:

‫Linux,‏ macOS או Cloud Shell

gcloud alpha storage ftp users update USERNAME --location=LOCATION_ID \
    --server=SERVER_ID \
    --storage-directory-mapping=bucket=BUCKET_NAME,bucket_prefix=BUCKET_PREFIX,directory=DIRECTORY,permission=SFTP_PERMISSION

‏Windows (PowerShell)

gcloud alpha storage ftp users update USERNAME --location=LOCATION_ID `
    --server=SERVER_ID `
    --storage-directory-mapping=bucket=BUCKET_NAME,bucket_prefix=BUCKET_PREFIX,directory=DIRECTORY,permission=SFTP_PERMISSION

Windows‏ (cmd.exe)

gcloud alpha storage ftp users update USERNAME --location=LOCATION_ID ^
    --server=SERVER_ID ^
    --storage-directory-mapping=bucket=BUCKET_NAME,bucket_prefix=BUCKET_PREFIX,directory=DIRECTORY,permission=SFTP_PERMISSION
העדכון של המשתמש יימשך כמה שניות.

אם למשתמש יש חיבור SFTP פעיל, יכול להיות שהוא יצטרך להתנתק ולהתחבר מחדש כדי שההגדרות המעודכנות של הקטגוריה ייכנסו לתוקף.

REST

כדי לעדכן את הקטגוריות של משתמש SFTP, משתמשים בשיטה servers.users.patch. בפרמטר השאילתה updateMask, מציינים את השדה storageDirectoryMappings.

לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הנתונים הבאים:

  • ‫PROJECT_ID: מזהה הפרויקט ב- Google Cloud של השרת.
  • ‫LOCATION_ID: המיקום של השרת, למשל us-west1.
  • ‫SERVER_ID: מזהה השרת.
  • ‫USERNAME: שם המשתמש של משתמש ה-SFTP.
  • ‫BUCKET_NAME: שם הקטגוריה שלמשתמש ה-SFTP יש גישה אליה, למשל example-bucket. לא כוללים את gs://.
  • (אופציונלי) BUCKET_PREFIX: הנתיב של תיקייה בתוך קטגוריית האחסון שרוצים להגדיר כתיקיית השורש למיפוי הזה של הספריות. אם לא מציינים את הערך הזה, Cloud FTP משתמש בשורש של הדלי.
  • ‫DIRECTORY: הנתיב של ספריית הנחיתה הלוגית שמוצג למשתמש ה-SFTP. לדוגמה, /home/uploads. אם משמיטים את הערך הזה, Cloud FTP מגדיר את ספריית הנחיתה כ-/.

    אם ממפים כמה קטגוריות או תיקיות, צריך לציין נתיב ספרייה ייחודי לכל מיפוי.

    אין תמיכה בספריות לוגיות מקוננות. אם מספקים כמה מיפויים לספרייה, צריך לספק את הספריות במבנה שטוח במקום במבנה בתצוגת עץ. לדוגמה, השתמשו ב-/dir1 וב-/dir2 במקום ב-/dir1 וב-/dir1/dir2.

  • ‫SFTP_PERMISSION: רמת הגישה לספרייה. כדי להגדיר הרשאת קריאה בלבד, צריך להגדיר את הערך הזה ל-READ_ONLY. כדי לקבל גישת קריאה וכתיבה, צריך להגדיר את הערך הזה ל-READ_WRITE.

כדי לתת למשתמש גישה לכמה קטגוריות, צריך לציין כמה מיפויים של קטגוריות ברשימה storageDirectoryMappings.

ה-method של ה-HTTP וכתובת ה-URL:

PATCH https://ftp.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/servers/SERVER_ID/users/USERNAME?updateMask=storageDirectoryMappings

תוכן בקשת JSON:

{
  "storageDirectoryMappings": [
    {
      "bucket": "BUCKET_NAME",
      "bucketPrefix": "BUCKET_PREFIX",
      "directory": "DIRECTORY",
      "permission": "SFTP_PERMISSION"
    }
  ]
}

כדי לשלוח את הבקשה צריך להרחיב אחת מהאפשרויות הבאות:

התגובה מזהה פעולה ממושכת. העדכון של המשתמש יימשך כמה שניות.

אם למשתמש יש חיבור SFTP פעיל, יכול להיות שהוא יצטרך להתנתק ואז להתחבר מחדש כדי שההגדרות המעודכנות של מאגר הנתונים יחולו.

ספריות לקוח

C#

כדי ללמוד איך מתקינים את ספריית הלקוח ואיך משתמשים בה ב-Cloud FTP, ראו: ספריות לקוח של Cloud FTP. מידע נוסף מופיע במאמרי העזרה של Cloud FTP C# API.

כדי לבצע אימות ב-Cloud FTP, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

using Google.Cloud.Ftp.V1;
using Google.LongRunning;
using Google.Protobuf.WellKnownTypes;
using System.Threading.Tasks;

public sealed partial class GeneratedCloudFtpClientSnippets
{
    /// <summary>Snippet for UpdateUserAsync</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 UpdateUserAsync()
    {
        // Create client
        CloudFtpClient cloudFtpClient = await CloudFtpClient.CreateAsync();
        // Initialize request argument(s)
        User user = new User();
        FieldMask updateMask = new FieldMask();
        // Make the request
        Operation<User, OperationMetadata> response = await cloudFtpClient.UpdateUserAsync(user, updateMask);

        // Poll until the returned long-running operation is complete
        Operation<User, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
        // Retrieve the operation result
        User result = completedResponse.Result;

        // Or get the name of the operation
        string operationName = response.Name;
        // This name can be stored, then the long-running operation retrieved later by name
        Operation<User, OperationMetadata> retrievedResponse = await cloudFtpClient.PollOnceUpdateUserAsync(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            User retrievedResult = retrievedResponse.Result;
        }
    }
}

Go

כדי ללמוד איך מתקינים את ספריית הלקוח ואיך משתמשים בה ב-Cloud FTP, ראו: ספריות לקוח של Cloud FTP. למידע נוסף, קראו את מאמרי העזרה של Cloud FTP Go API.

כדי לבצע אימות ב-Cloud FTP, אתם צריכים להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.


//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.UpdateUserRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#UpdateUserRequest.
	}
	op, err := c.UpdateUser(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

כדי ללמוד איך מתקינים את ספריית הלקוח ואיך משתמשים בה ב-Cloud FTP, ראו: ספריות לקוח של Cloud FTP. למידע נוסף, קראו את מאמרי העזרה של Cloud FTP Java API.

כדי לבצע אימות ב-Cloud FTP, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

import com.google.api.core.ApiFuture;
import com.google.cloud.ftp.v1.CloudFtpClient;
import com.google.cloud.ftp.v1.UpdateUserRequest;
import com.google.cloud.ftp.v1.User;
import com.google.longrunning.Operation;
import com.google.protobuf.FieldMask;

public class AsyncUpdateUser {

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

  public static void asyncUpdateUser() 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()) {
      UpdateUserRequest request =
          UpdateUserRequest.newBuilder()
              .setUpdateMask(FieldMask.newBuilder().build())
              .setUser(User.newBuilder().build())
              .build();
      ApiFuture<Operation> future = cloudFtpClient.updateUserCallable().futureCall(request);
      // Do something.
      Operation response = future.get();
    }
  }
}

Node.js

מידע על התקנה ושימוש בספריית הלקוח של Cloud FTP מופיע במאמר ספריות הלקוח של Cloud FTP. מידע נוסף מופיע במאמרי העזרה של Cloud FTP Node.js API.

כדי לבצע אימות ב-Cloud FTP, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

/**
 * 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.
 */
/**
 *  Optional. Field mask is used to specify the fields to be overwritten in the
 *  User resource by the update.
 *  The fields specified in the update_mask are relative to the resource, not
 *  the full request. A field will be overwritten if it is in the mask. If the
 *  user does not provide a mask then all fields present in the request will be
 *  overwritten.
 */
// const updateMask = {}
/**
 *  Required. The resource being updated
 */
// const user = {}

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

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

async function callUpdateUser() {
  // Construct request
  const request = {
    user,
  };

  // Run request
  const [operation] = await ftpClient.updateUser(request);
  const [response] = await operation.promise();
  console.log(response);
}

callUpdateUser();

PHP

כדי ללמוד איך מתקינים את ספריית הלקוח ואיך משתמשים בה ב-Cloud FTP, ראו: ספריות לקוח של Cloud FTP. למידע נוסף, קראו את מאמרי העזרה של Cloud FTP PHP API.

כדי לבצע אימות ב-Cloud FTP, אתם צריכים להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Ftp\V1\Client\CloudFtpClient;
use Google\Cloud\Ftp\V1\StorageDirectoryMapping;
use Google\Cloud\Ftp\V1\StorageDirectoryMapping\Permission;
use Google\Cloud\Ftp\V1\UpdateUserRequest;
use Google\Cloud\Ftp\V1\User;
use Google\Cloud\Ftp\V1\UserCredential;
use Google\Cloud\Ftp\V1\UserCredential\Type;
use Google\Rpc\Status;

/**
 * Updates the parameters of a single User.
 *
 * @param string $userCustomerServiceAccount             Service account in customer project attached to this SFTP User.
 * @param string $userUserCredentialsCredentialName      Name of the user credential.
 * @param int    $userUserCredentialsCredentialType      Type of credential.
 * @param string $userStorageDirectoryMappingsBucket     Name of the bucket.
 * @param string $userStorageDirectoryMappingsDirectory  Directory where the user lands in the SFTP server.
 * @param int    $userStorageDirectoryMappingsPermission Permission to the bucket.
 */
function update_user_sample(
    string $userCustomerServiceAccount,
    string $userUserCredentialsCredentialName,
    int $userUserCredentialsCredentialType,
    string $userStorageDirectoryMappingsBucket,
    string $userStorageDirectoryMappingsDirectory,
    int $userStorageDirectoryMappingsPermission
): void {
    // Create a client.
    $cloudFtpClient = new CloudFtpClient();

    // Prepare the request message.
    $userCredential = (new UserCredential())
        ->setCredentialName($userUserCredentialsCredentialName)
        ->setCredentialType($userUserCredentialsCredentialType);
    $userUserCredentials = [$userCredential];
    $storageDirectoryMapping = (new StorageDirectoryMapping())
        ->setBucket($userStorageDirectoryMappingsBucket)
        ->setDirectory($userStorageDirectoryMappingsDirectory)
        ->setPermission($userStorageDirectoryMappingsPermission);
    $userStorageDirectoryMappings = [$storageDirectoryMapping];
    $user = (new User())
        ->setCustomerServiceAccount($userCustomerServiceAccount)
        ->setUserCredentials($userUserCredentials)
        ->setStorageDirectoryMappings($userStorageDirectoryMappings);
    $request = (new UpdateUserRequest())
        ->setUser($user);

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

        if ($response->operationSucceeded()) {
            /** @var User $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
    $userCustomerServiceAccount = '[CUSTOMER_SERVICE_ACCOUNT]';
    $userUserCredentialsCredentialName = '[CREDENTIAL_NAME]';
    $userUserCredentialsCredentialType = Type::TYPE_UNSPECIFIED;
    $userStorageDirectoryMappingsBucket = '[BUCKET]';
    $userStorageDirectoryMappingsDirectory = '[DIRECTORY]';
    $userStorageDirectoryMappingsPermission = Permission::PERMISSION_UNSPECIFIED;

    update_user_sample(
        $userCustomerServiceAccount,
        $userUserCredentialsCredentialName,
        $userUserCredentialsCredentialType,
        $userStorageDirectoryMappingsBucket,
        $userStorageDirectoryMappingsDirectory,
        $userStorageDirectoryMappingsPermission
    );
}

Python

מידע על התקנה ושימוש בספריית הלקוח של Cloud FTP מופיע במאמר ספריות הלקוח של Cloud FTP. מידע נוסף מופיע במאמרי העזרה של Cloud FTP Python API.

כדי לבצע אימות ב-Cloud FTP, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

# 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_update_user():
    # Create a client
    client = ftp_v1.CloudFtpClient()

    # Initialize request argument(s)
    user = ftp_v1.User()
    user.customer_service_account = "customer_service_account_value"
    user.user_credentials.credential_name = "credential_name_value"
    user.user_credentials.credential_type = "PUBLIC_KEY"
    user.storage_directory_mappings.bucket = "bucket_value"
    user.storage_directory_mappings.directory = "directory_value"
    user.storage_directory_mappings.permission = "READ_WRITE"

    request = ftp_v1.UpdateUserRequest(
        user=user,
    )

    # Make the request
    operation = client.update_user(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)

Ruby

מידע על התקנה ושימוש בספריית הלקוח של Cloud FTP מופיע במאמר ספריות הלקוח של Cloud FTP. למידע נוסף, קראו את מאמרי העזרה של Cloud FTP Ruby API.

כדי לבצע אימות ב-Cloud FTP, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

require "google/cloud/ftp/v1"

##
# Snippet for the update_user 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#update_user.
#
def update_user
  # 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::UpdateUserRequest.new

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

  # The returned object is of type Gapic::Operation. You can use it to
  # check the status of an operation, cancel it, or wait for results.
  # Here is how to wait for a response.
  result.wait_until_done! timeout: 60
  if result.response?
    p result.response
  else
    puts "No response received."
  end
end