/// <summary>
        /// Updates the attributes of the Project identified by the specified`project_id` (for example, `my-project-123`).The caller must have modify permissions for this Project.
        /// Documentation https://developers.google.com/cloudresourcemanager/v1beta1/reference/projects/update
        /// 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 Cloudresourcemanager service.</param>
        /// <param name="projectId">The project ID (for example, `my-project-123`).Required.</param>
        /// <param name="body">A valid Cloudresourcemanager v1beta1 body.</param>
        /// <returns>ProjectResponse</returns>
        public static Project Update(CloudresourcemanagerService service, string projectId, Project 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.Projects.Update(body, projectId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Projects.Update failed.", ex);
            }
        }
        /// <summary>
        /// Sets the IAM access control policy for the specified Project. Replacesany existing policy.The following constraints apply when using `setIamPolicy()`:+ Project does not support `allUsers` and `allAuthenticatedUsers` as`members` in a `Binding` of a `Policy`.+ The owner role can be granted only to `user` and `serviceAccount`.+ Service accounts can be made owners of a project directlywithout any restrictions. However, to be added as an owner, a user must beinvited via Cloud Platform console and must accept the invitation.+ A user cannot be granted the owner role using `setIamPolicy()`. The usermust be granted the owner role using the Cloud Platform Console and mustexplicitly accept the invitation.+ Invitations to grant the owner role cannot be sent using`setIamPolicy()`; they must be sent only using the Cloud Platform Console.+ Membership changes that leave the project without any owners that haveaccepted the Terms of Service (ToS) will be rejected.+ If the project is not part of an organization, there must be at leastone owner who has accepted the Terms of Service (ToS) agreement in thepolicy. Calling `setIamPolicy()` to remove the last ToS-accepted ownerfrom the policy will fail. This restriction also applies to legacyprojects that no longer have owners who have accepted the ToS. Edits toIAM policies will be rejected until the lack of a ToS-accepting owner isrectified.+ Calling this method requires enabling the App Engine Admin API.Note: Removing service accounts from policies or changing their rolescan render services completely inoperable. It is important to understandhow the service account is being used before removing or updating itsroles.
        /// Documentation https://developers.google.com/cloudresourcemanager/v1beta1/reference/projects/setIamPolicy
        /// 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 Cloudresourcemanager service.</param>
        /// <param name="resource">REQUIRED: The resource for which the policy is being specified.See the operation documentation for the appropriate value for this field.</param>
        /// <param name="body">A valid Cloudresourcemanager v1beta1 body.</param>
        /// <returns>PolicyResponse</returns>
        public static Policy SetIamPolicy(CloudresourcemanagerService service, string resource, SetIamPolicyRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (resource == null)
                {
                    throw new ArgumentNullException(resource);
                }

                // Make the request.
                return(service.Projects.SetIamPolicy(body, resource).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Projects.SetIamPolicy failed.", ex);
            }
        }
Example #3
0
        /// <summary>
        /// Returns permissions that a caller has on the specified Folder.The `resource` field should be the Folder's resource name,e.g. "folders/1234".There are no permissions required for making this API call.
        /// Documentation https://developers.google.com/cloudresourcemanager/v2beta1/reference/folders/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 Cloudresourcemanager service.</param>
        /// <param name="resource">REQUIRED: The resource for which the policy detail is being requested.See the operation documentation for the appropriate value for this field.</param>
        /// <param name="body">A valid Cloudresourcemanager v2beta1 body.</param>
        /// <returns>TestIamPermissionsResponseResponse</returns>
        public static TestIamPermissionsResponse TestIamPermissions(CloudresourcemanagerService service, string resource, TestIamPermissionsRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (resource == null)
                {
                    throw new ArgumentNullException(resource);
                }

                // Make the request.
                return(service.Folders.TestIamPermissions(body, resource).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Folders.TestIamPermissions failed.", ex);
            }
        }
        /// <summary>
        /// Creates a Project resource.Initially, the Project resource is owned by its creator exclusively.The creator can later grant permission to others to read or update theProject.Several APIs are activated automatically for the Project, includingGoogle Cloud Storage.
        /// Documentation https://developers.google.com/cloudresourcemanager/v1beta1/reference/projects/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 Cloudresourcemanager service.</param>
        /// <param name="body">A valid Cloudresourcemanager v1beta1 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>ProjectResponse</returns>
        public static Project Create(CloudresourcemanagerService service, Project body, ProjectsCreateOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }

                // Building the initial request.
                var request = service.Projects.Create(body);

                // Applying optional parameters to the request.
                request = (ProjectsResource.CreateRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Projects.Create failed.", ex);
            }
        }
Example #5
0
        /// <summary>
        /// Updates a Folder, changing its display_name.Changes to the folder display_name will be rejected if they violate eitherthe display_name formatting rules or naming constraints described inthe [CreateFolder] documentation.+ The Folder's display name must start and end with a letter or digit,may contain letters, digits, spaces, hyphens and underscores and can beno longer than 30 characters. This is captured by the regular expression:[\p{L}\p{N}]({\p{L}\p{N}_- ]{0,28}[\p{L}\p{N}])?.The caller must have `resourcemanager.folders.update` permission on theidentified folder.If the update fails due to the unique name constraint then aPreconditionFailure explaining this violation will be returnedin the Status.details field.
        /// Documentation https://developers.google.com/cloudresourcemanager/v2beta1/reference/folders/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 Cloudresourcemanager service.</param>
        /// <param name="name">Output only. The resource name of the Folder.Its format is `folders/{folder_id}`, for example: "folders/1234".</param>
        /// <param name="body">A valid Cloudresourcemanager v2beta1 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>FolderResponse</returns>
        public static Folder Patch(CloudresourcemanagerService service, string name, Folder body, FoldersPatchOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (name == null)
                {
                    throw new ArgumentNullException(name);
                }

                // Building the initial request.
                var request = service.Folders.Patch(body, name);

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Folders.Patch failed.", ex);
            }
        }
Example #6
0
        /// <summary>
        /// Moves a Folder under a new resource parent.Returns an Operation which can be used to track the progress of thefolder move workflow.Upon success the Operation.response field will be populated with themoved Folder.Upon failure, a FolderOperationError categorizing the failure cause willbe returned - if the failure occurs synchronously then theFolderOperationError will be returned via the Status.details fieldand if it occurs asynchronously then the FolderOperation will be returnedvia the the Operation.error field.In addition, the Operation.metadata field will be populated with aFolderOperation message as an aid to stateless clients.Folder moves will be rejected if they violate either the naming, heightor fanout constraints described in the [CreateFolder] documentation.The caller must have `resourcemanager.folders.move` permission on thefolder's current and proposed new parent.
        /// Documentation https://developers.google.com/cloudresourcemanager/v2beta1/reference/folders/move
        /// 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 Cloudresourcemanager service.</param>
        /// <param name="name">The resource name of the Folder to move.Must be of the form folders/{folder_id}</param>
        /// <param name="body">A valid Cloudresourcemanager v2beta1 body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Move(CloudresourcemanagerService service, string name, MoveFolderRequest 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.Folders.Move(body, name).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Folders.Move failed.", ex);
            }
        }
        /// <summary>
        /// Gets the effective `Policy` on a resource. This is the result of merging`Policies` in the resource hierarchy. The returned `Policy` will not havean `etag`set because it is a computed `Policy` across multiple resources.
        /// Documentation https://developers.google.com/cloudresourcemanager/v1/reference/folders/getEffectiveOrgPolicy
        /// 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 Cloudresourcemanager service.</param>
        /// <param name="resource">The name of the resource to start computing the effective `Policy`.</param>
        /// <param name="body">A valid Cloudresourcemanager v1 body.</param>
        /// <returns>OrgPolicyResponse</returns>
        public static OrgPolicy GetEffectiveOrgPolicy(CloudresourcemanagerService service, string resource, GetEffectiveOrgPolicyRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (resource == null)
                {
                    throw new ArgumentNullException(resource);
                }

                // Make the request.
                return(service.Folders.GetEffectiveOrgPolicy(body, resource).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Folders.GetEffectiveOrgPolicy failed.", ex);
            }
        }
        /// <summary>
        /// Updates an Organization resource identified by the specified resource name.
        /// Documentation https://developers.google.com/cloudresourcemanager/v1beta1/reference/organizations/update
        /// 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 Cloudresourcemanager service.</param>
        /// <param name="name">Output Only. The resource name of the organization. This is theorganization's relative path in the API. Its format is"organizations/[organization_id]". For example, "organizations/1234".</param>
        /// <param name="body">A valid Cloudresourcemanager v1beta1 body.</param>
        /// <returns>OrganizationResponse</returns>
        public static Organization Update(CloudresourcemanagerService service, string name, Organization 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.Organizations.Update(body, name).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Organizations.Update failed.", ex);
            }
        }
        /// <summary>
        /// Fetches an Organization resource identified by the specified resource name.
        /// Documentation https://developers.google.com/cloudresourcemanager/v1beta1/reference/organizations/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 Cloudresourcemanager service.</param>
        /// <param name="name">The resource name of the Organization to fetch, e.g. "organizations/1234".</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OrganizationResponse</returns>
        public static Organization Get(CloudresourcemanagerService service, string name, OrganizationsGetOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (name == null)
                {
                    throw new ArgumentNullException(name);
                }

                // Building the initial request.
                var request = service.Organizations.Get(name);

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Organizations.Get failed.", ex);
            }
        }
        /// <summary>
        /// Lists all the `Policies` set for a particular resource.
        /// Documentation https://developers.google.com/cloudresourcemanager/v1/reference/organizations/listOrgPolicies
        /// 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 Cloudresourcemanager service.</param>
        /// <param name="resource">Name of the resource to list Policies for.</param>
        /// <param name="body">A valid Cloudresourcemanager v1 body.</param>
        /// <returns>ListOrgPoliciesResponseResponse</returns>
        public static ListOrgPoliciesResponse ListOrgPolicies(CloudresourcemanagerService service, string resource, ListOrgPoliciesRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (resource == null)
                {
                    throw new ArgumentNullException(resource);
                }

                // Make the request.
                return(service.Organizations.ListOrgPolicies(body, resource).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Organizations.ListOrgPolicies failed.", ex);
            }
        }
Example #11
0
        /// <summary>
        /// Delete a Lien by `name`.Callers of this method will require permission on the `parent` resource.For example, a Lien with a `parent` of `projects/1234` requires permission`resourcemanager.projects.updateLiens`.
        /// Documentation https://developers.google.com/cloudresourcemanager/v1/reference/liens/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 Cloudresourcemanager service.</param>
        /// <param name="name">The name/identifier of the Lien to delete.</param>
        /// <returns>EmptyResponse</returns>
        public static Empty Delete(CloudresourcemanagerService 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.Liens.Delete(name).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Liens.Delete failed.", ex);
            }
        }
Example #12
0
        /// <summary>
        /// Create a Lien which applies to the resource denoted by the `parent` field.Callers of this method will require permission on the `parent` resource.For example, applying to `projects/1234` requires permission`resourcemanager.projects.updateLiens`.NOTE: Some resources may limit the number of Liens which may be applied.
        /// Documentation https://developers.google.com/cloudresourcemanager/v1/reference/liens/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 Cloudresourcemanager service.</param>
        /// <param name="body">A valid Cloudresourcemanager v1 body.</param>
        /// <returns>LienResponse</returns>
        public static Lien Create(CloudresourcemanagerService service, Lien body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }

                // Make the request.
                return(service.Liens.Create(body).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Liens.Create failed.", ex);
            }
        }
Example #13
0
        /// <summary>
        /// Search for folders that match specific filter criteria.Search provides an eventually consistent view of the folders a user hasaccess to which meet the specified filter criteria.This will only return folders on which the caller has thepermission `resourcemanager.folders.get`.
        /// Documentation https://developers.google.com/cloudresourcemanager/v2beta1/reference/folders/search
        /// 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 Cloudresourcemanager service.</param>
        /// <param name="body">A valid Cloudresourcemanager v2beta1 body.</param>
        /// <returns>SearchFoldersResponseResponse</returns>
        public static SearchFoldersResponse Search(CloudresourcemanagerService service, SearchFoldersRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }

                // Make the request.
                return(service.Folders.Search(body).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Folders.Search failed.", ex);
            }
        }
Example #14
0
        /// <summary>
        /// List all Liens applied to the `parent` resource.Callers of this method will require permission on the `parent` resource.For example, a Lien with a `parent` of `projects/1234` requires permission`resourcemanager.projects.get`.
        /// Documentation https://developers.google.com/cloudresourcemanager/v1/reference/liens/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 Cloudresourcemanager service.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>ListLiensResponseResponse</returns>
        public static ListLiensResponse List(CloudresourcemanagerService service, LiensListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

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

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

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