Exemplo n.º 1
0
 def ResourceInfo(self, args):
     return resource_info.ResourceInfo(
         list_format="""
       table(
         .:label=REPOSITORY,
         last_update():label=LAST_UPDATE
       )
     """,
         transforms=_COMPONENTS_REPOSITORIES_TRANSFORMS,
     )
Exemplo n.º 2
0
def Get(collection, must_be_registered=False):
    """Returns the ResourceInfo for collection or None if not registered.

  Args:
    collection: The resource collection.
    must_be_registered: Raises exception if True, otherwise returns None.

  Raises:
    UnregisteredCollectionError: If collection is not registered and
      must_be_registered is True.

  Returns:
    The ResourceInfo for collection or an default ResourceInfo if not
      registered.
  """
    info = RESOURCE_REGISTRY.get(collection, None)
    if not info:
        if not must_be_registered:
            return resource_info.ResourceInfo()
        raise resource_exceptions.UnregisteredCollectionError(
            'Collection [{0}] is not registered.'.format(collection))
    info.collection = collection
    return info
Exemplo n.º 3
0
"""Resource info registry."""

from googlecloudsdk.core.resource import resource_exceptions
from googlecloudsdk.core.resource import resource_info

RESOURCE_REGISTRY = {

    # cloud billing
    'cloudbilling.billingAccounts':
    resource_info.ResourceInfo(
        cache_command='billing accounts list',
        # TODO(b/22402915) Delete this when OP resource completion is
        # supported.
        bypass_cache=True,
        list_format="""
          table(
            name.basename():label=ID,
            displayName:label=NAME,
            open
          )
        """,
    ),

    # cloud key management system
    'cloudkms.projects.locations':
    resource_info.ResourceInfo(
        bypass_cache=True,
        list_command='kms locations list --format=value(location_id)',
        list_format="""
          table(
            locationId
Exemplo n.º 4
0
"""Resource info registry."""

from googlecloudsdk.core.resource import resource_exceptions
from googlecloudsdk.core.resource import resource_info

RESOURCE_REGISTRY = {

    # cloud billing
    'cloudbilling.billingAccounts':
    resource_info.ResourceInfo(
        cache_command='billing accounts list',
        # TODO(b/22402915) Delete this when OP resource completion is
        # supported.
        bypass_cache=True,
        list_format="""
          table(
            name.basename():label=ID,
            displayName:label=NAME,
            open
          )
        """,
    ),
    # Cloud SDK client side resources

    # compute

    # This entry is needed due to a bug in the resource parser. It will be
    # removable when the new completion code lands.
    'compute.instances':
    resource_info.ResourceInfo(
        async_collection='compute.operations',
Exemplo n.º 5
0
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""A list of resources and their canonical format. This is deprecated."""

from googlecloudsdk.core.resource import resource_info

RESOURCE_REGISTRY = {
    'compute.addresses':
    resource_info.ResourceInfo(
        cache_command='compute addresses list',
        list_format="""
          table(
            name,
            region.basename(),
            address,
            status
          )
        """,
    ),
    'compute.autoscalers':
    resource_info.ResourceInfo(
        async_collection='compute.operations',
        cache_command='compute autoscaler list',
        list_format="""
          table(
            name,
            target.basename(),
            autoscalingPolicy.policy():label=POLICY
          )
Exemplo n.º 6
0
# See the License for the specific language governing permissions and
# limitations under the License.
"""Resource info registry."""

from googlecloudsdk.core.resource import resource_exceptions
from googlecloudsdk.core.resource import resource_info

RESOURCE_REGISTRY = {

    # appengine
    'appengine.instances':
    resource_info.ResourceInfo(list_format="""
          table(
            service:sort=1,
            version:sort=2,
            id:sort=3,
            instance.vmStatus.yesno(no="N/A"),
            instance.vmUnlocked.yesno(yes="YES", no=""):label=DEBUG_MODE
          )
        """, ),
    'appengine.module_versions':
    resource_info.ResourceInfo(list_format="""
          table(
            module,
            version,
            traffic_split.format("{0:.2f}", .)
          )
        """, ),
    'appengine.regions':
    resource_info.ResourceInfo(list_format="""
          table(
Exemplo n.º 7
0
"""Resource info registry."""

from googlecloudsdk.core.resource import resource_exceptions
from googlecloudsdk.core.resource import resource_info

RESOURCE_REGISTRY = {

    # cloud billing
    'cloudbilling.billingAccounts':
    resource_info.ResourceInfo(
        cache_command='billing accounts list',
        # TODO(b/22402915) Delete this when OP resource completion is
        # supported.
        bypass_cache=True,
        list_format="""
          table(
            name.basename():label=ID,
            displayName:label=NAME,
            open
          )
        """,
    ),

    # iam
    'iam.service_accounts':
    resource_info.ResourceInfo(
        list_command='iam service-accounts list --format=value(email)',
        bypass_cache=True,
        list_format="""
          table(
            displayName:label=NAME,
"""Resource info registry."""

from googlecloudsdk.core.resource import resource_exceptions
from googlecloudsdk.core.resource import resource_info

RESOURCE_REGISTRY = {

    # cloud billing
    'cloudbilling.billingAccounts':
    resource_info.ResourceInfo(
        cache_command='billing accounts list',
        # TODO(b/22402915) Delete this when OP resource completion is
        # supported.
        bypass_cache=True,
        list_format="""
          table(
            name.basename():label=ID,
            displayName:label=NAME,
            open
          )
        """,
    ),

    # cloud build
    'cloudbuild.projects.builds':
    resource_info.ResourceInfo(
        cache_command='cloud build list',
        bypass_cache=True,
        async_collection='cloudbuild.projects.builds',
        list_format="""
          table(
"""Resource info registry."""

from googlecloudsdk.core.resource import resource_exceptions
from googlecloudsdk.core.resource import resource_info

RESOURCE_REGISTRY = {

    # cloud billing
    'cloudbilling.billingAccounts':
    resource_info.ResourceInfo(
        cache_command='billing accounts list',
        # TODO(b/22402915) Delete this when OP resource completion is
        # supported.
        bypass_cache=True,
        list_format="""
          table(
            name.basename():label=ID,
            displayName:label=NAME,
            open
          )
        """,
    ),

    # cloud key management system
    'cloudkms.projects.locations':
    resource_info.ResourceInfo(
        bypass_cache=True,
        list_command='kms locations list --format=value(location_id)',
        list_format="""
          table(
            locationId