GooglePlayInstant/Editor/QuickDeploy/GcpClient.cs
/// <summary>
/// Executes all the steps required for deploying a file to GCP according to developer's configuration.
/// First verifies if configured bucket exists, and creates the bucket if it does not exist. It then uploads
/// the file to GCP and sets the visibility of the file to public.
/// </summary>
Executes all the steps required for deploying a file to GCP according to developer's configuration.
First verifies if configured bucket exists, and creates the bucket if it does not exist. It then uploads
the file to GCP and sets the visibility of the file to public.
Executes all the steps required for deploying a file to GCP according to developer ' s configuration . First verifies if configured bucket exists and creates the bucket if it does not exist . It then uploads the file to GCP and sets the visibility of the file to public .
public static void DeployConfiguredFile()
        {
            InvokeAccessRestrictedAction(CheckBucketExistence, bucketInfoResponse =>
            {
                if (string.IsNullOrEmpty(bucketInfoResponse.error))
                {
                    var response = JsonUtility.FromJson<BucketInfoResponse>(bucketInfoResponse.text);
                    var bucketName = response.name;
                    if (!string.Equals(bucketName, QuickDeployWindow.Config.CloudStorageBucketName))
                    {
                        throw new Exception(string.Format(
                            "Response bucket name \"{0}\" doesn't match expected name \"{1}\"",
                            bucketName, QuickDeployWindow.Config.CloudStorageBucketName));
                    }
                    UploadBundleAndMakePublic();
                    return;
                }
                if (!bucketInfoResponse.error.StartsWith("404"))
                {
                    throw new Exception(string.Format(
                        "Error verifying bucket existence: {0} \n {1}", bucketInfoResponse.error,
                        bucketInfoResponse.error));
                }
                InvokeAccessRestrictedAction(CreateBucket, bucketCreationResponse =>
                {
                    var error = bucketCreationResponse.error;
                    if (!string.IsNullOrEmpty(error))
                    {
                        throw new Exception(string.Format("Error creating bucket: {0}\n{1}",
                            error, bucketCreationResponse.text));
                    }
                    Debug.Log("Google Cloud Storage bucket was successfully created.");
                    UploadBundleAndMakePublic();
                });
            });
        }
public static void DeployConfiguredFile ( ) { InvokeAccessRestrictedAction ( CheckBucketExistence , bucketInfoResponse => { if ( string . IsNullOrEmpty ( bucketInfoResponse . error ) ) { var response = JsonUtility . FromJson < BucketInfoResponse > ( bucketInfoResponse . text ) ; var bucketName = response . name ; if ( ! string . Equals ( bucketName , QuickDeployWindow . Config . CloudStorageBucketName ) ) { throw new Exception ( string . Format ( " \" \" \" \" " , bucketName , QuickDeployWindow . Config . CloudStorageBucketName ) ) ; } UploadBundleAndMakePublic ( ) ; return ; } if ( ! bucketInfoResponse . error . StartsWith ( " " ) ) { throw new Exception ( string . Format ( " \n " , bucketInfoResponse . error , bucketInfoResponse . error ) ) ; } InvokeAccessRestrictedAction ( CreateBucket , bucketCreationResponse => { var error = bucketCreationResponse . error ; if ( ! string . IsNullOrEmpty ( error ) ) { throw new Exception ( string . Format ( " \n " , error , bucketCreationResponse . text ) ) ; } Debug . Log ( " " ) ; UploadBundleAndMakePublic ( ) ; } ) ; } ) ; }
Executes all the steps required for deploying a file to GCP according to developer's configuration.
Executes all the steps required for deploying a file to GCP according to developer ' s configuration .
// No error indicates that the bucket exists. Confirm the bucket name is correct and upload the file. // Any HTTP Status Code other than 404 is a fatal error. // HTTP Status Code 404 indicates that the bucket doesn't exist, so create it. 