/// <summary>
        /// Lists all manifests for a given deployment.
        /// Documentation https://developers.google.com/deploymentmanager/v2/reference/manifests/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 Deploymentmanager service.</param>
        /// <param name="project">The project ID for this request.</param>
        /// <param name="deployment">The name of the deployment for this request.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>ManifestsListResponseResponse</returns>
        public static ManifestsListResponse List(DeploymentmanagerService service, string project, string deployment, ManifestsListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (deployment == null)
                {
                    throw new ArgumentNullException(deployment);
                }

                // Building the initial request.
                var request = service.Manifests.List(project, deployment);

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Manifests.List failed.", ex);
            }
        }
        /// <summary>
        /// Gets information about a specific manifest.
        /// Documentation https://developers.google.com/deploymentmanager/v2/reference/manifests/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 Deploymentmanager service.</param>
        /// <param name="project">The project ID for this request.</param>
        /// <param name="deployment">The name of the deployment for this request.</param>
        /// <param name="manifest">The name of the manifest for this request.</param>
        /// <returns>ManifestResponse</returns>
        public static Manifest Get(DeploymentmanagerService service, string project, string deployment, string manifest)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (deployment == null)
                {
                    throw new ArgumentNullException(deployment);
                }
                if (manifest == null)
                {
                    throw new ArgumentNullException(manifest);
                }

                // Make the request.
                return(service.Manifests.Get(project, deployment, manifest).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Manifests.Get failed.", ex);
            }
        }
        /// <summary>
        /// Cancels and removes the preview currently associated with the deployment.
        /// Documentation https://developers.google.com/deploymentmanager/v2/reference/deployments/cancelPreview
        /// 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 Deploymentmanager service.</param>
        /// <param name="project">The project ID for this request.</param>
        /// <param name="deployment">The name of the deployment for this request.</param>
        /// <param name="body">A valid Deploymentmanager v2 body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation CancelPreview(DeploymentmanagerService service, string project, string deployment, DeploymentsCancelPreviewRequest 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 (deployment == null)
                {
                    throw new ArgumentNullException(deployment);
                }

                // Make the request.
                return(service.Deployments.CancelPreview(body, project, deployment).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Deployments.CancelPreview failed.", ex);
            }
        }
        /// <summary>
        /// Returns permissions that a caller has on the specified resource.
        /// Documentation https://developers.google.com/deploymentmanager/v2/reference/deployments/testIamPermissions
        /// 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 Deploymentmanager service.</param>
        /// <param name="project">Project ID for this request.</param>
        /// <param name="resource">Name of the resource for this request.</param>
        /// <param name="body">A valid Deploymentmanager v2 body.</param>
        /// <returns>TestPermissionsResponseResponse</returns>
        public static TestPermissionsResponse TestIamPermissions(DeploymentmanagerService service, string project, string resource, TestPermissionsRequest 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 (resource == null)
                {
                    throw new ArgumentNullException(resource);
                }

                // Make the request.
                return(service.Deployments.TestIamPermissions(body, project, resource).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Deployments.TestIamPermissions failed.", ex);
            }
        }
        /// <summary>
        /// Creates a deployment and all of the resources described by the deployment manifest.
        /// Documentation https://developers.google.com/deploymentmanager/v2/reference/deployments/insert
        /// 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 Deploymentmanager service.</param>
        /// <param name="project">The project ID for this request.</param>
        /// <param name="body">A valid Deploymentmanager v2 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Insert(DeploymentmanagerService service, string project, Deployment body, DeploymentsInsertOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }

                // Building the initial request.
                var request = service.Deployments.Insert(body, project);

                // Applying optional parameters to the request.
                request = (DeploymentsResource.InsertRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Deployments.Insert failed.", ex);
            }
        }
        /// <summary>
        /// Gets the access control policy for a resource. May be empty if no such policy or resource exists.
        /// Documentation https://developers.google.com/deploymentmanager/v2/reference/deployments/getIamPolicy
        /// 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 Deploymentmanager service.</param>
        /// <param name="project">Project ID for this request.</param>
        /// <param name="resource">Name of the resource for this request.</param>
        /// <returns>PolicyResponse</returns>
        public static Policy GetIamPolicy(DeploymentmanagerService service, string project, string resource)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (resource == null)
                {
                    throw new ArgumentNullException(resource);
                }

                // Make the request.
                return(service.Deployments.GetIamPolicy(project, resource).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Deployments.GetIamPolicy failed.", ex);
            }
        }
        /// <summary>
        /// Gets information about a specific operation.
        /// Documentation https://developers.google.com/deploymentmanager/v2/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 Deploymentmanager service.</param>
        /// <param name="project">The project ID for this request.</param>
        /// <param name="operation">The name of the operation for this request.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Get(DeploymentmanagerService service, string project, string operation)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (operation == null)
                {
                    throw new ArgumentNullException(operation);
                }

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