예제 #1
0
        /// <summary>
        /// Cancels a requested build in progress.
        /// Documentation https://developers.google.com/cloudbuild/v1/reference/builds/cancel
        /// 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 CloudBuild service.</param>
        /// <param name="projectId">ID of the project.</param>
        /// <param name="id">ID of the build.</param>
        /// <param name="body">A valid CloudBuild v1 body.</param>
        /// <returns>BuildResponse</returns>
        public static Build Cancel(CloudBuildService service, string projectId, string id, CancelBuildRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (projectId == null)
                {
                    throw new ArgumentNullException(projectId);
                }
                if (id == null)
                {
                    throw new ArgumentNullException(id);
                }

                // Make the request.
                return(service.Builds.Cancel(body, projectId, id).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Builds.Cancel failed.", ex);
            }
        }
예제 #2
0
        /// Documentation https://developers.google.com/cloudbuild/v1/reference/builds/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 CloudBuild service.</param>
        /// <param name="projectId">ID of the project.</param>
        /// <param name="body">A valid CloudBuild v1 body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Create(CloudBuildService service, string projectId, Build body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (projectId == null)
                {
                    throw new ArgumentNullException(projectId);
                }

                // Make the request.
                return(service.Builds.Create(body, projectId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Builds.Create failed.", ex);
            }
        }
예제 #3
0
        /// Documentation https://developers.google.com/cloudbuild/v1/reference/builds/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 CloudBuild service.</param>
        /// <param name="projectId">ID of the project.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>ListBuildsResponseResponse</returns>
        public static ListBuildsResponse List(CloudBuildService service, string projectId, BuildsListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (projectId == null)
                {
                    throw new ArgumentNullException(projectId);
                }

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

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Builds.List failed.", ex);
            }
        }
예제 #4
0
        /// Documentation https://developers.google.com/cloudbuild/v1/reference/operations/cancel
        /// 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 CloudBuild service.</param>
        /// <param name="name">The name of the operation resource to be cancelled.</param>
        /// <param name="body">A valid CloudBuild v1 body.</param>
        /// <returns>EmptyResponse</returns>
        public static Empty Cancel(CloudBuildService service, string name, CancelOperationRequest 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.Operations.Cancel(body, name).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Operations.Cancel failed.", ex);
            }
        }
        /// Documentation https://developers.google.com/cloudbuild/v1/reference/triggers/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 CloudBuild service.</param>
        /// <param name="projectId">ID of the project that owns the trigger.</param>
        /// <param name="triggerId">ID of the BuildTrigger to update.</param>
        /// <param name="body">A valid CloudBuild v1 body.</param>
        /// <returns>BuildTriggerResponse</returns>
        public static BuildTrigger Patch(CloudBuildService service, string projectId, string triggerId, BuildTrigger body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (projectId == null)
                {
                    throw new ArgumentNullException(projectId);
                }
                if (triggerId == null)
                {
                    throw new ArgumentNullException(triggerId);
                }

                // Make the request.
                return(service.Triggers.Patch(body, projectId, triggerId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Triggers.Patch failed.", ex);
            }
        }
예제 #6
0
        /// Documentation https://developers.google.com/cloudbuild/v1/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 CloudBuild service.</param>
        /// <param name="name">The name of the operation resource.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Get(CloudBuildService 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.Operations.Get(name).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Operations.Get failed.", ex);
            }
        }
        /// Documentation https://developers.google.com/cloudbuild/v1/reference/triggers/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 CloudBuild service.</param>
        /// <param name="projectId">ID of the project for which to list BuildTriggers.</param>
        /// <returns>ListBuildTriggersResponseResponse</returns>
        public static ListBuildTriggersResponse List(CloudBuildService 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.Triggers.List(projectId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Triggers.List failed.", ex);
            }
        }