Exemple #1
0
    def take_action(self, args):
        if args.connection_secret and args.connection:
            raise exceptions.CoriolisException(
                "Please specify either --connection or "
                "--connection-secret, but not both")

        conn_info = get_connnection_info_from_args(args)
        endpoint = self.app.client_manager.coriolis.endpoints.create(
            args.name,
            args.provider,
            conn_info,
            args.description,
            regions=args.regions)

        if not args.skip_validation:
            valid, message = (
                self.app.client_manager.coriolis.endpoints.validate_connection(
                    endpoint.id))
            if not valid:
                raise exceptions.EndpointConnectionValidationFailed(message)

        return EndpointDetailFormatter().get_formatted_entity(endpoint)
Exemple #2
0
 def take_action(self, args):
     endpoints = self.app.client_manager.coriolis.endpoints
     valid, message = endpoints.validate_connection(args.id)
     if not valid:
         raise exceptions.EndpointConnectionValidationFailed(message)