Exemple #1
0
def get_content_bucket_by_name(
    context: object,
    deployment_name: str,
    resource_group_name: str = dynamic_content_settings.
    get_default_resource_group(),
    bucket_name: str = dynamic_content_settings.get_default_bucket_name()
) -> str:
    """ 
        Returns the resource id of the content bucket
    
        Arguments
            context -- context to use
            deployment_name -- name of the deployment
            resource_group_name -- name of the resource group
            bucket_name -- name of the bucket
        """
    if not deployment_name:
        deployment_name = context.config.default_deployment

    stack_id = context.config.get_resource_group_stack_id(deployment_name,
                                                          resource_group_name,
                                                          optional=True)
    bucket_resource = context.stack.get_physical_resource_id(
        stack_id, bucket_name)
    return bucket_resource
def get_content_bucket(context: object) -> str:
    """ 
        Returns the resource id of the default content bucket
    
        Arguments
            context -- context to use
    """
    return get_content_bucket_by_name(context, context.config.default_deployment, dynamic_content_settings.get_default_resource_group(),
                                      dynamic_content_settings.get_default_bucket_name())
def _get_content_bucket_by_name(
    context,
    deployment_name,
    resource_group_name=dynamic_content_settings.get_default_resource_group(),
    bucket_name=dynamic_content_settings.get_default_bucket_name()):
    '''Returns the resource id of the content bucket.'''
    if deployment_name is None:
        deployment_name = context.config.default_deployment

    stack_id = context.config.get_resource_group_stack_id(deployment_name,
                                                          resource_group_name,
                                                          optional=True)
    bucketResource = context.stack.get_physical_resource_id(
        stack_id, bucket_name)
    return bucketResource
def _get_content_bucket(context):
    return _get_content_bucket_by_name(
        context, context.config.default_deployment,
        dynamic_content_settings.get_default_resource_group(),
        dynamic_content_settings.get_default_bucket_name())