예제 #1
0
    def Run(self, args):
        holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
        client = holder.client

        (backend_services_utils.
         IsDefaultRegionalBackendServicePropertyNoneWarnOtherwise())
        backend_service_ref = (
            flags.GLOBAL_REGIONAL_BACKEND_SERVICE_ARG.ResolveAsResource(
                args,
                holder.resources,
                scope_lister=compute_flags.GetDefaultScopeLister(client)))

        backend_service = backend_services_utils.SendGetRequest(
            client, backend_service_ref)

        codecs.RegisterL7TrafficControlCodecs(self.GetApiVersion())
        if args.destination:
            with files.FileWriter(args.destination) as stream:
                export_util.Export(message=backend_service,
                                   stream=stream,
                                   schema_path=self.GetSchemaPath())
        else:
            export_util.Export(message=backend_service,
                               stream=sys.stdout,
                               schema_path=self.GetSchemaPath())
예제 #2
0
def _Run(args, holder, url_map_arg, release_track):
    """Issues requests necessary to export URL maps."""
    client = holder.client

    url_map_ref = url_map_arg.ResolveAsResource(
        args,
        holder.resources,
        scope_lister=compute_flags.GetDefaultScopeLister(client))

    url_map = url_maps_utils.SendGetRequest(client, url_map_ref)

    codecs.RegisterL7TrafficControlCodecs(_GetApiVersion(release_track))
    if args.destination:
        with files.FileWriter(args.destination) as stream:
            export_util.Export(message=url_map,
                               stream=stream,
                               schema_path=_GetSchemaPath(release_track))
    else:
        export_util.Export(message=url_map,
                           stream=sys.stdout,
                           schema_path=_GetSchemaPath(release_track))