示例#1
0
        /// <summary>
        /// Returns the Google service account that is used by Storage Transfer Service to access buckets in the project where transfers run or in other projects. Each Google service account is associated with one Google Developers Console project. Users should add this service account to the Google Cloud Storage bucket ACLs to grant access to Storage Transfer Service. This service account is created and owned by Storage Transfer Service and can only be used by Storage Transfer Service.
        /// Documentation https://developers.google.com/storagetransfer/v1/reference/v1/getGoogleServiceAccount
        /// 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="optional">Optional paramaters.</param>        /// <returns>GoogleServiceAccountResponse</returns>
        public static GoogleServiceAccount GetGoogleServiceAccount(storagetransferService service, V1GetGoogleServiceAccountOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

                // Building the initial request.
                var request = service.V1.GetGoogleServiceAccount();

                // Applying optional parameters to the request.
                request = (V1Resource.GetGoogleServiceAccountRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request V1.GetGoogleServiceAccount failed.", ex);
            }
        }
示例#2
0
        /// <summary>
        /// Lists transfer jobs.
        /// Documentation https://developers.google.com/storagetransfer/v1/reference/transferJobs/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 storagetransfer service.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>ListTransferJobsResponseResponse</returns>
        public static ListTransferJobsResponse List(storagetransferService service, TransferJobsListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

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

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TransferJobs.List failed.", ex);
            }
        }