/// <summary>
        /// Lists all clusters in a project.
        /// Documentation https://developers.google.com/dataproc/v1beta1/reference/clusters/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 dataproc service.</param>
        /// <param name="projectId">[Required] The ID of the Google Cloud Platform project that the cluster belongs to.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>ListClustersResponseResponse</returns>
        public static ListClustersResponse List(dataprocService service, string projectId, ClustersListOptionalParms 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.Clusters.List(projectId);

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Clusters.List failed.", ex);
            }
        }
        /// <summary>
        /// Creates a cluster in a project.
        /// Documentation https://developers.google.com/dataproc/v1beta1/reference/clusters/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 dataproc service.</param>
        /// <param name="projectId">[Required] The ID of the Google Cloud Platform project that the cluster belongs to.</param>
        /// <param name="body">A valid dataproc v1beta1 body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Create(dataprocService service, string projectId, Cluster 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.Clusters.Create(body, projectId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Clusters.Create failed.", ex);
            }
        }
        /// <summary>
        /// Gets the resource representation for a job in a project.
        /// Documentation https://developers.google.com/dataproc/v1beta1/reference/jobs/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 dataproc service.</param>
        /// <param name="projectId">[Required] The ID of the Google Cloud Platform project that the job belongs to.</param>
        /// <param name="jobId">[Required] The job ID.</param>
        /// <returns>JobResponse</returns>
        public static Job Get(dataprocService service, string projectId, string jobId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (projectId == null)
                {
                    throw new ArgumentNullException(projectId);
                }
                if (jobId == null)
                {
                    throw new ArgumentNullException(jobId);
                }

                // Make the request.
                return(service.Jobs.Get(projectId, jobId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Jobs.Get failed.", ex);
            }
        }
        /// <summary>
        /// Gets the resource representation for a cluster in a project.
        /// Documentation https://developers.google.com/dataproc/v1beta1/reference/clusters/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 dataproc service.</param>
        /// <param name="projectId">[Required] The ID of the Google Cloud Platform project that the cluster belongs to.</param>
        /// <param name="clusterName">[Required] The cluster name.</param>
        /// <returns>ClusterResponse</returns>
        public static Cluster Get(dataprocService service, string projectId, string clusterName)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (projectId == null)
                {
                    throw new ArgumentNullException(projectId);
                }
                if (clusterName == null)
                {
                    throw new ArgumentNullException(clusterName);
                }

                // Make the request.
                return(service.Clusters.Get(projectId, clusterName).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Clusters.Get failed.", ex);
            }
        }
        /// <summary>
        /// Submits a job to a cluster.
        /// Documentation https://developers.google.com/dataproc/v1beta1/reference/jobs/submit
        /// 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 dataproc service.</param>
        /// <param name="projectId">[Required] The ID of the Google Cloud Platform project that the job belongs to.</param>
        /// <param name="body">A valid dataproc v1beta1 body.</param>
        /// <returns>JobResponse</returns>
        public static Job Submit(dataprocService service, string projectId, SubmitJobRequest 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.Jobs.Submit(body, projectId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Jobs.Submit failed.", ex);
            }
        }
        /// <summary>
        /// Gets cluster diagnostic information. After the operation completes, the Operation.response field contains `DiagnoseClusterOutputLocation`.
        /// Documentation https://developers.google.com/dataproc/v1/reference/clusters/diagnose
        /// 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 dataproc service.</param>
        /// <param name="projectId">[Required] The ID of the Google Cloud Platform project that the cluster belongs to.</param>
        /// <param name="region">[Required] The Cloud Dataproc region in which to handle the request.</param>
        /// <param name="clusterName">[Required] The cluster name.</param>
        /// <param name="body">A valid dataproc v1 body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Diagnose(dataprocService service, string projectId, string region, string clusterName, DiagnoseClusterRequest 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 (region == null)
                {
                    throw new ArgumentNullException(region);
                }
                if (clusterName == null)
                {
                    throw new ArgumentNullException(clusterName);
                }

                // Make the request.
                return(service.Clusters.Diagnose(body, projectId, region, clusterName).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Clusters.Diagnose failed.", ex);
            }
        }
        /// <summary>
        /// Starts a job cancellation request. To access the job resource after cancellation, call [regions/{region}/jobs.list](/dataproc/reference/rest/v1/projects.regions.jobs/list) or [regions/{region}/jobs.get](/dataproc/reference/rest/v1/projects.regions.jobs/get).
        /// Documentation https://developers.google.com/dataproc/v1/reference/jobs/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 dataproc service.</param>
        /// <param name="projectId">[Required] The ID of the Google Cloud Platform project that the job belongs to.</param>
        /// <param name="region">[Required] The Cloud Dataproc region in which to handle the request.</param>
        /// <param name="jobId">[Required] The job ID.</param>
        /// <param name="body">A valid dataproc v1 body.</param>
        /// <returns>JobResponse</returns>
        public static Job Cancel(dataprocService service, string projectId, string region, string jobId, CancelJobRequest 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 (region == null)
                {
                    throw new ArgumentNullException(region);
                }
                if (jobId == null)
                {
                    throw new ArgumentNullException(jobId);
                }

                // Make the request.
                return(service.Jobs.Cancel(body, projectId, region, jobId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Jobs.Cancel failed.", ex);
            }
        }
        /// <summary>
        /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use [operations.get](/dataproc/reference/rest/v1beta1/operations/get) or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation.
        /// Documentation https://developers.google.com/dataproc/v1beta1/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 dataproc service.</param>
        /// <param name="name">The name of the operation resource to be cancelled.</param>
        /// <param name="body">A valid dataproc v1beta1 body.</param>
        /// <returns>EmptyResponse</returns>
        public static Empty Cancel(dataprocService 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);
            }
        }
Beispiel #9
0
        /// <summary>
        /// Gets the latest state of a long-running operation. Clients may use this method to poll the operation result at intervals as recommended by the API service. 
        /// Documentation https://developers.google.com/dataproc/v1alpha1/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 dataproc service.</param>  
        /// <param name="name">The operation resource name.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Get(dataprocService 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);
            }
        }
        /// <summary>
        /// Request to update a cluster in a project.
        /// Documentation https://developers.google.com/dataproc/v1alpha1/reference/clusters/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 dataproc service.</param>
        /// <param name="projectId">[Required] The ID of the Google Cloud Platform project the cluster belongs to.</param>
        /// <param name="region">[Required] The Dataproc region in which to handle the request.</param>
        /// <param name="clusterName">[Required] The cluster name.</param>
        /// <param name="body">A valid dataproc v1alpha1 body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>OperationResponse</returns>
        public static Operation Patch(dataprocService service, string projectId, string region, string clusterName, Cluster body, ClustersPatchOptionalParms optional = null)
        {
            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 (region == null)
                {
                    throw new ArgumentNullException(region);
                }
                if (clusterName == null)
                {
                    throw new ArgumentNullException(clusterName);
                }

                // Building the initial request.
                var request = service.Clusters.Patch(body, projectId, region, clusterName);

                // Applying optional parameters to the request.
                request = (ClustersResource.PatchRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Clusters.Patch failed.", ex);
            }
        }
        /// <summary>
        /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
        /// Documentation https://developers.google.com/dataproc/v1/reference/operations/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 dataproc service.</param>
        /// <param name="name">The name of the operation resource to be deleted.</param>
        /// <returns>EmptyResponse</returns>
        public static Empty Delete(dataprocService 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.Delete(name).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Operations.Delete failed.", ex);
            }
        }