protected override void ProcessRecord()
        {
            string project;
            string firewallName;

            switch (ParameterSetName)
            {
            case ParameterSetNames.ByName:
                project      = Project;
                firewallName = FirewallName;
                break;

            case ParameterSetNames.ByObject:
                project      = GetProjectNameFromUri(InputObject.SelfLink);
                firewallName = InputObject.Name;
                break;

            default:
                throw UnknownParameterSetException;
            }
            if (ShouldProcess($"{project}/{firewallName}", "Remove Firewall"))
            {
                DeleteRequest request = Service.Firewalls.Delete(project, firewallName);
                WaitForGlobalOperation(project, request.Execute());
            }
        }
Ejemplo n.º 2
0
 private Permission DeletePermission(DriveService service, string fileId, string who)
 {
     try
     {
         DeleteRequest req = service.Permissions.Delete(fileId, GetPermissionIdForEmail(service, who));
         req.Execute();
     }
     catch (Exception e)
     {
         throw new Exception("An error occurred: " + e.Message);
     }
     return(null);
 }