Esempio n. 1
0
        protected override void ProcessRecord()
        {
            SslCertsCreateEphemeralRequest body = new SslCertsCreateEphemeralRequest
            {
                PublicKey = PublicKey
            };

            SslCertsResource.CreateEphemeralRequest request = Service.SslCerts.CreateEphemeral(body, Project, Instance);
            WriteVerbose($"Adding an ephemeral SSL Certificate to the Instance {Instance}.");
            SslCert result = request.Execute();

            WriteObject(result);
        }
 protected override void ProcessRecord()
 {
     SslCertsCreateEphemeralRequest body = new SslCertsCreateEphemeralRequest
     {
         PublicKey = PublicKey
     };
     SslCertsResource.CreateEphemeralRequest request = Service.SslCerts.CreateEphemeral(body, Project, Instance);
     WriteVerbose($"Adding an ephemeral SSL Certificate to the Instance {Instance}.");
     SslCert result = request.Execute();
     WriteObject(result);
 }
        /// <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);
            }
        }