Esempio n. 1
0
        /// <summary>
        /// Updates a resource containing information about a database inside a Cloud SQL instance.
        /// Documentation https://developers.google.com/sqladmin/v1beta4/reference/databases/update
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated SQLAdmin service.</param>
        /// <param name="project">Project ID of the project that contains the instance.</param>
        /// <param name="instance">Database instance ID. This does not include the project ID.</param>
        /// <param name="database">Name of the database to be updated in the instance.</param>
        /// <param name="body">A valid SQLAdmin v1beta4 body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Update(SQLAdminService service, string project, string instance, string database, Database body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (instance == null)
                {
                    throw new ArgumentNullException(instance);
                }
                if (database == null)
                {
                    throw new ArgumentNullException(database);
                }

                // Make the request.
                return(service.Databases.Update(body, project, instance, database).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Databases.Update failed.", ex);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Deletes a user from a Cloud SQL instance.
        /// Documentation https://developers.google.com/sqladmin/v1beta4/reference/users/delete
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated SQLAdmin service.</param>
        /// <param name="project">Project ID of the project that contains the instance.</param>
        /// <param name="instance">Database instance ID. This does not include the project ID.</param>
        /// <param name="host">Host of the user in the instance.</param>
        /// <param name="name">Name of the user in the instance.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Delete(SQLAdminService service, string project, string instance, string host, string name)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (instance == null)
                {
                    throw new ArgumentNullException(instance);
                }
                if (host == null)
                {
                    throw new ArgumentNullException(host);
                }
                if (name == null)
                {
                    throw new ArgumentNullException(name);
                }

                // Make the request.
                return(service.Users.Delete(project, instance, host, name).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Users.Delete failed.", ex);
            }
        }
        /// <summary>
        /// Retrieves an instance operation that has been performed on an instance.
        /// Documentation https://developers.google.com/sqladmin/v1beta4/reference/operations/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated SQLAdmin service.</param>
        /// <param name="project">Project ID of the project that contains the instance.</param>
        /// <param name="operation">Instance operation ID.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Get(SQLAdminService service, string project, string operation)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (operation == null)
                {
                    throw new ArgumentNullException(operation);
                }

                // Make the request.
                return(service.Operations.Get(project, operation).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Operations.Get failed.", ex);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Retrieves information about a specified backup run for a Cloud SQL instance.
        /// Documentation https://developers.google.com/sqladmin/v1beta3/reference/backupRuns/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated SQLAdmin service.</param>
        /// <param name="project">Project ID of the project that contains the instance.</param>
        /// <param name="instance">Cloud SQL instance ID. This does not include the project ID.</param>
        /// <param name="backupConfiguration">Identifier for the backup configuration. This gets generated automatically when a backup configuration is created.</param>
        /// <param name="dueTime">The start time of the four-hour backup window. The backup can occur any time in the window. The time is in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.</param>
        /// <returns>BackupRunResponse</returns>
        public static BackupRun Get(SQLAdminService service, string project, string instance, string backupConfiguration, string dueTime)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (instance == null)
                {
                    throw new ArgumentNullException(instance);
                }
                if (backupConfiguration == null)
                {
                    throw new ArgumentNullException(backupConfiguration);
                }
                if (dueTime == null)
                {
                    throw new ArgumentNullException(dueTime);
                }

                // Make the request.
                return(service.BackupRuns.Get(project, instance, backupConfiguration, dueTime).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request BackupRuns.Get failed.", ex);
            }
        }
        /// <summary>
        /// Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.
        /// Documentation https://developers.google.com/sqladmin/v1beta4/reference/sslCerts/createEphemeral
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated SQLAdmin service.</param>
        /// <param name="project">Project ID of the Cloud SQL project.</param>
        /// <param name="instance">Cloud SQL instance ID. This does not include the project ID.</param>
        /// <param name="body">A valid SQLAdmin v1beta4 body.</param>
        /// <returns>SslCertResponse</returns>
        public static SslCert CreateEphemeral(SQLAdminService service, string project, string instance, SslCertsCreateEphemeralRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (instance == null)
                {
                    throw new ArgumentNullException(instance);
                }

                // Make the request.
                return(service.SslCerts.CreateEphemeral(body, project, instance).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request SslCerts.CreateEphemeral failed.", ex);
            }
        }
        /// <summary>
        /// Lists all instance operations that have been performed on the given Cloud SQL instance in the reverse chronological order of the start time.
        /// Documentation https://developers.google.com/sqladmin/v1beta4/reference/operations/list
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated SQLAdmin service.</param>
        /// <param name="project">Project ID of the project that contains the instance.</param>
        /// <param name="instance">Cloud SQL instance ID. This does not include the project ID.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>OperationsListResponseResponse</returns>
        public static OperationsListResponse List(SQLAdminService service, string project, string instance, OperationsListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (instance == null)
                {
                    throw new ArgumentNullException(instance);
                }

                // Building the initial request.
                var request = service.Operations.List(project, instance);

                // Applying optional parameters to the request.
                request = (OperationsResource.ListRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Operations.List failed.", ex);
            }
        }
        /// <summary>
        /// Deletes the SSL certificate. The change will not take effect until the instance is restarted.
        /// Documentation https://developers.google.com/sqladmin/v1beta4/reference/sslCerts/delete
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated SQLAdmin service.</param>
        /// <param name="project">Project ID of the project that contains the instance to be deleted.</param>
        /// <param name="instance">Cloud SQL instance ID. This does not include the project ID.</param>
        /// <param name="sha1Fingerprint">Sha1 FingerPrint.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Delete(SQLAdminService service, string project, string instance, string sha1Fingerprint)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (instance == null)
                {
                    throw new ArgumentNullException(instance);
                }
                if (sha1Fingerprint == null)
                {
                    throw new ArgumentNullException(sha1Fingerprint);
                }

                // Make the request.
                return(service.SslCerts.Delete(project, instance, sha1Fingerprint).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request SslCerts.Delete failed.", ex);
            }
        }
        /// <summary>
        /// Lists all of the current SSL certificates for the instance.
        /// Documentation https://developers.google.com/sqladmin/v1beta4/reference/sslCerts/list
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated SQLAdmin service.</param>
        /// <param name="project">Project ID of the project for which to list Cloud SQL instances.</param>
        /// <param name="instance">Cloud SQL instance ID. This does not include the project ID.</param>
        /// <returns>SslCertsListResponseResponse</returns>
        public static SslCertsListResponse List(SQLAdminService service, string project, string instance)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (instance == null)
                {
                    throw new ArgumentNullException(instance);
                }

                // Make the request.
                return(service.SslCerts.List(project, instance).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request SslCerts.List failed.", ex);
            }
        }
        /// <summary>
        /// Creates a Cloud SQL instance as a clone of a source instance.
        /// Documentation https://developers.google.com/sqladmin/v1beta3/reference/instances/clone
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated SQLAdmin service.</param>
        /// <param name="project">Project ID of the source as well as the clone Cloud SQL instance.</param>
        /// <param name="body">A valid SQLAdmin v1beta3 body.</param>
        /// <returns>InstancesCloneResponseResponse</returns>
        public static InstancesCloneResponse Clone(SQLAdminService service, string project, InstancesCloneRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }

                // Make the request.
                return(service.Instances.Clone(body, project).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Instances.Clone failed.", ex);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Stops the replication in the read replica instance.
        /// Documentation https://developers.google.com/sqladmin/v1beta4/reference/instances/stopReplica
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated SQLAdmin service.</param>
        /// <param name="project">ID of the project that contains the read replica.</param>
        /// <param name="instance">Cloud SQL read replica instance name.</param>
        /// <returns>OperationResponse</returns>
        public static Operation StopReplica(SQLAdminService service, string project, string instance)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (instance == null)
                {
                    throw new ArgumentNullException(instance);
                }

                // Make the request.
                return(service.Instances.StopReplica(project, instance).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Instances.StopReplica failed.", ex);
            }
        }
        /// <summary>
        /// Sets the password for the root user of the specified Cloud SQL instance.
        /// Documentation https://developers.google.com/sqladmin/v1beta3/reference/instances/setRootPassword
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated SQLAdmin service.</param>
        /// <param name="project">Project ID of the project that contains the instance.</param>
        /// <param name="instance">Cloud SQL instance ID. This does not include the project ID.</param>
        /// <param name="body">A valid SQLAdmin v1beta3 body.</param>
        /// <returns>InstancesSetRootPasswordResponseResponse</returns>
        public static InstancesSetRootPasswordResponse SetRootPassword(SQLAdminService service, string project, string instance, InstanceSetRootPasswordRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (instance == null)
                {
                    throw new ArgumentNullException(instance);
                }

                // Make the request.
                return(service.Instances.SetRootPassword(body, project, instance).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Instances.SetRootPassword failed.", ex);
            }
        }
        /// <summary>
        /// Deletes all client certificates and generates a new server SSL certificate for a Cloud SQL instance.
        /// Documentation https://developers.google.com/sqladmin/v1beta3/reference/instances/resetSslConfig
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated SQLAdmin service.</param>
        /// <param name="project">Project ID of the project that contains the instance.</param>
        /// <param name="instance">Cloud SQL instance ID. This does not include the project ID.</param>
        /// <returns>InstancesResetSslConfigResponseResponse</returns>
        public static InstancesResetSslConfigResponse ResetSslConfig(SQLAdminService service, string project, string instance)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (instance == null)
                {
                    throw new ArgumentNullException(instance);
                }

                // Make the request.
                return(service.Instances.ResetSslConfig(project, instance).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Instances.ResetSslConfig failed.", ex);
            }
        }
        /// <summary>
        /// Updates the settings of a Cloud SQL instance. This method supports patch semantics.
        /// Documentation https://developers.google.com/sqladmin/v1beta3/reference/instances/patch
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated SQLAdmin service.</param>
        /// <param name="project">Project ID of the project that contains the instance.</param>
        /// <param name="instance">Cloud SQL instance ID. This does not include the project ID.</param>
        /// <param name="body">A valid SQLAdmin v1beta3 body.</param>
        /// <returns>InstancesUpdateResponseResponse</returns>
        public static InstancesUpdateResponse Patch(SQLAdminService service, string project, string instance, DatabaseInstance body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (instance == null)
                {
                    throw new ArgumentNullException(instance);
                }

                // Make the request.
                return(service.Instances.Patch(body, project, instance).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Instances.Patch failed.", ex);
            }
        }
Esempio n. 14
0
        /// <summary>
        /// Creates a new backup run on demand. This method is applicable only to Second Generation instances.
        /// Documentation https://developers.google.com/sqladmin/v1beta4/reference/backupRuns/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated SQLAdmin service.</param>
        /// <param name="project">Project ID of the project that contains the instance.</param>
        /// <param name="instance">Cloud SQL instance ID. This does not include the project ID.</param>
        /// <param name="body">A valid SQLAdmin v1beta4 body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Insert(SQLAdminService service, string project, string instance, BackupRun body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (instance == null)
                {
                    throw new ArgumentNullException(instance);
                }

                // Make the request.
                return(service.BackupRuns.Insert(body, project, instance).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request BackupRuns.Insert failed.", ex);
            }
        }
Esempio n. 15
0
        /// <summary>
        /// List all available database flags for Google Cloud SQL instances.
        /// Documentation https://developers.google.com/sqladmin/v1beta4/reference/flags/list
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated SQLAdmin service.</param>
        /// <returns>FlagsListResponseResponse</returns>
        public static FlagsListResponse List(SQLAdminService service)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

                // Make the request.
                return(service.Flags.List().Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Flags.List failed.", ex);
            }
        }
Esempio n. 16
0
 public GcSqlCmdlet()
 {
     Service = new SQLAdminService(GetBaseClientServiceInitializer());
 }
 public GcSqlCmdlet()
 {
     Service = new SQLAdminService(GetBaseClientServiceInitializer());
 }