
                            d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ dd	l
mZ ddlmZ dd
lmZ ddlmZ ddlmZ  e	j,                  e	j.                  j0                  e	j.                  j2                  e	j.                  j4                        e	j6                   G d de	j8                                      Zy)zICommand for deleting a Cloud Security Command Center notification config.    )absolute_import)division)print_function)unicode_literals)securitycenter_client)base)flags)util)notification_util)log)
console_ioc                   2    e Zd ZdZddddZed        Zd Zy)	Deletez5Delete a Security Command Center notification config.a        Delete a Security Command Center notification config.

      Notification configs that are created with Security Command Center API V2
      and later include a `location` attribute. If the `location` attribute is
      included in the resource name of a Notification configs, you must specify
      it when referencing the Notification config. For example, the following
      Notification configs name has `location=eu`:
      `organizations/123/locations/eu/notificationConfigs/test-config`.
      a        Delete notification config 'test-config' from organization `123`

        $ {command} test-config --organization=123

      Delete notification config 'test-config' from folder `456`

        $ {command} test-config --folder=456

      Delete notification config 'test-config' from project `789`

        $ {command} test-config --project=789

      Delete notification config 'test-config' with location `global` from
      organization `123`

        $ {command} test-config --organization=123 --location=global

      Delete notification config 'test-config' with `location=eu` from
      organization `123`

        $ {command} test-config --organization=123 --location=eu
      z      This command uses the Security Command Center API. For more information,
      see [Security Command Center API.](https://cloud.google.com/security-command-center/docs/reference/rest)
      )DESCRIPTIONEXAMPLESzAPI REFERENCEc                     t        j                  |        t        j                  |        t        j                  j                  |        t         j                  j                  |        y )N)notifications_flagsAddParentGroup'AddNotificationConfigPositionalArgument	scc_flagsAPI_VERSION_FLAGAddToParser(DELETE_NOTIFICATION_CONFIG_LOCATION_FLAG)parsers    'lib/surface/scc/notifications/delete.pyArgszDelete.ArgsO   sK     &&v.??G**62@@LL    c                    t        j                  dd       t        j                  |      }t	        j
                  ||       t        j                  ||j                  d      }t        j                  |      }t        j                  |      }|dk(  rF|j                         }t	        j                  |      |_        |j                  j                  |      }nE|j!                         }t	        j"                  |      |_        |j$                  j                  |      }t&        j(                  j+                  d       |S )Nz7Are you sure you want to delete a notification config?
T)messagecancel_on_no)"version_specific_existing_resourcev1zDeleted.)r   PromptContinuescc_utilGetParentFromNamedArgumentsr    ValidateMutexOnConfigIdAndParentGetVersionFromArgumentsNOTIFICATIONCONFIGIDr   GetMessages	GetClient;SecuritycenterOrganizationsNotificationConfigsDeleteRequest&ValidateAndGetNotificationConfigV1Namename!organizations_notificationConfigsr   DSecuritycenterOrganizationsLocationsNotificationConfigsDeleteRequest&ValidateAndGetNotificationConfigV2Name+organizations_locations_notificationConfigsr   statusPrint)selfargsparentversionmessagesclientreqresults           r   Runz
Delete.RunZ   s    J 11$7F66tVD
 ..d''DG %009H",,W5F$

N
N
P 
 #II$Och77>>sCf 
W
W
Y 
 #II$OchAAHHMfJJZ Mr   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r<    r   r   r   r       s8    
 >	

.
E&-P  "r   r   N)r@   
__future__r   r   r   r   googlecloudsdk.api_lib.sccr   googlecloudsdk.callioper   googlecloudsdk.command_lib.sccr	   r   r
   r$   ,googlecloudsdk.command_lib.scc.notificationsr   r   googlecloudsdk.corer   googlecloudsdk.core.consoler   ReleaseTracksReleaseTrackGABETAALPHADefaultUniverseOnlyDeleteCommandr   rC   r   r   <module>rR      s    P &  % ' < ( = ; U J # 2 $++00$2C2C2I2I XT X Xr   