/// <summary>
        /// Updates a transfer job. Updating a job's transfer spec does not affecttransfer operations that are running already. Updating the schedulingof a job is not allowed.
        /// Documentation https://developers.google.com/storagetransfer/v1/reference/transferJobs/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 Storagetransfer service.</param>
        /// <param name="jobName">The name of job to update.Required.</param>
        /// <param name="body">A valid Storagetransfer v1 body.</param>
        /// <returns>TransferJobResponse</returns>
        public static TransferJob Patch(StoragetransferService service, string jobName, UpdateTransferJobRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (jobName == null)
                {
                    throw new ArgumentNullException(jobName);
                }

                // Make the request.
                return(service.TransferJobs.Patch(body, jobName).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TransferJobs.Patch failed.", ex);
            }
        }
        /// <summary>
        /// Gets a transfer job.
        /// Documentation https://developers.google.com/storagetransfer/v1/reference/transferJobs/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 Storagetransfer service.</param>
        /// <param name="jobName">The job to get.Required.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>TransferJobResponse</returns>
        public static TransferJob Get(StoragetransferService service, string jobName, TransferJobsGetOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (jobName == null)
                {
                    throw new ArgumentNullException(jobName);
                }

                // Building the initial request.
                var request = service.TransferJobs.Get(jobName);

                // Applying optional parameters to the request.
                request = (TransferJobsResource.GetRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TransferJobs.Get failed.", ex);
            }
        }
        /// <summary>
        /// Pauses a transfer operation.
        /// Documentation https://developers.google.com/storagetransfer/v1/reference/transferOperations/pause
        /// 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 Storagetransfer service.</param>
        /// <param name="name">The name of the transfer operation.Required.</param>
        /// <param name="body">A valid Storagetransfer v1 body.</param>
        /// <returns>EmptyResponse</returns>
        public static Empty Pause(StoragetransferService service, string name, PauseTransferOperationRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (name == null)
                {
                    throw new ArgumentNullException(name);
                }

                // Make the request.
                return(service.TransferOperations.Pause(body, name).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TransferOperations.Pause failed.", ex);
            }
        }
        /// <summary>
        /// Returns the Google service account that is used by Storage TransferService to access buckets in the project where transfersrun or in other projects. Each Google service account is associatedwith one Google Cloud Platform Console project. Usersshould add this service account to the Google Cloud Storage bucketACLs to grant access to Storage Transfer Service. This serviceaccount is created and owned by Storage Transfer Service and canonly be used by Storage Transfer Service.
        /// Documentation https://developers.google.com/storagetransfer/v1/reference/googleServiceAccounts/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 Storagetransfer service.</param>
        /// <param name="projectId">The ID of the Google Cloud Platform Console project that the Google serviceaccount is associated with.Required.</param>
        /// <returns>GoogleServiceAccountResponse</returns>
        public static GoogleServiceAccount Get(StoragetransferService service, string projectId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (projectId == null)
                {
                    throw new ArgumentNullException(projectId);
                }

                // Make the request.
                return(service.GoogleServiceAccounts.Get(projectId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request GoogleServiceAccounts.Get failed.", ex);
            }
        }
        /// <summary>
        /// Creates a transfer job that runs periodically.
        /// Documentation https://developers.google.com/storagetransfer/v1/reference/transferJobs/create
        /// 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 Storagetransfer service.</param>
        /// <param name="body">A valid Storagetransfer v1 body.</param>
        /// <returns>TransferJobResponse</returns>
        public static TransferJob Create(StoragetransferService service, TransferJob body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }

                // Make the request.
                return(service.TransferJobs.Create(body).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TransferJobs.Create failed.", ex);
            }
        }
        /// <summary>
        /// Gets the latest state of a long-running operation.  Clients can use thismethod to poll the operation result at intervals as recommended by the APIservice.
        /// Documentation https://developers.google.com/storagetransfer/v1/reference/transferOperations/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 Storagetransfer service.</param>
        /// <param name="name">The name of the operation resource.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Get(StoragetransferService service, string name)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (name == null)
                {
                    throw new ArgumentNullException(name);
                }

                // Make the request.
                return(service.TransferOperations.Get(name).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TransferOperations.Get failed.", ex);
            }
        }