Esempio n. 1
0
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
"""Definition for conversion between legacy YAML and the API JSON formats."""

from __future__ import absolute_import
from googlecloudsdk.third_party.appengine.admin.tools.conversion import converters as c
from googlecloudsdk.third_party.appengine.admin.tools.conversion import schema as s

SCHEMA = s.Message(
    api_config=s.Message(url=s.Value(converter=c.ToJsonString),
                         login=s.Value(converter=c.EnumConverter('LOGIN')),
                         secure=s.Value('security_level',
                                        converter=c.EnumConverter('SECURE')),
                         auth_fail_action=s.Value(
                             converter=c.EnumConverter('AUTH_FAIL_ACTION')),
                         script=s.Value(converter=c.ToJsonString)),
    api_version=s.Value('runtime_api_version', converter=c.ToJsonString),
    auto_id_policy=s.Value('beta_settings',
                           lambda val: {'auto_id_policy': val}),
    automatic_scaling=s.Message(
        converter=c.ConvertAutomaticScaling,
        cool_down_period_sec=s.Value('cool_down_period',
                                     converter=c.SecondsToDuration),
        cpu_utilization=s.Message(target_utilization=s.Value(),
                                  aggregation_window_length_sec=s.Value(
Esempio n. 2
0
class _Collector(object):
    """Manages a PluginResult in a thread-safe context."""
    def __init__(self):
        self.result = PluginResult()
        self.lock = threading.Lock()


_LOG_FUNCS = {
    'info': logging.info,
    'error': logging.error,
    'warn': logging.warn,
    'debug': logging.debug
}

# A section consisting only of scripts.
_EXEC_SECTION = schema.Message(python=schema.Value(converter=str))

_RUNTIME_SCHEMA = schema.Message(name=schema.Value(converter=str),
                                 description=schema.Value(converter=str),
                                 author=schema.Value(converter=str),
                                 api_version=schema.Value(converter=str),
                                 generate_configs=schema.Message(
                                     python=schema.Value(converter=str),
                                     files_to_copy=schema.RepeatedField(
                                         element=schema.Value(converter=str)),
                                 ),
                                 detect=_EXEC_SECTION,
                                 collect_data=_EXEC_SECTION,
                                 prebuild=_EXEC_SECTION,
                                 postbuild=_EXEC_SECTION)
Esempio n. 3
0
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
"""Definition for conversion between legacy YAML and the API JSON formats."""

from googlecloudsdk.third_party.appengine.admin.tools.conversion import converters as c
from googlecloudsdk.third_party.appengine.admin.tools.conversion import schema as s


SCHEMA = s.Message(
    api_config=s.Message(
        url=s.Value(converter=c.ToJsonString),
        login=s.Value(converter=c.EnumConverter('LOGIN')),
        secure=s.Value('security_level', converter=c.EnumConverter('SECURE')),
        auth_fail_action=s.Value(converter=c.EnumConverter('AUTH_FAIL_ACTION')),
        script=s.Value(converter=c.ToJsonString)),
    auto_id_policy=s.Value('beta_settings',
                           lambda val: {'auto_id_policy': val}),
    automatic_scaling=s.Message(
        converter=c.ConvertAutomaticScaling,
        cool_down_period_sec=s.Value('cool_down_period',
                                     converter=c.SecondsToDuration),
        cpu_utilization=s.Message(
            target_utilization=s.Value(),
            aggregation_window_length_sec=s.Value('aggregation_window_length',
                                                  converter=c.SecondsToDuration)
        ),
Esempio n. 4
0
  def __init__(self):
    self.result = PluginResult()
    self.lock = threading.Lock()


_LOG_FUNCS = {
    'info': logging.info,
    'error': logging.error,
    'warn': logging.warn,
    'debug': logging.debug
}

# A section consisting only of scripts.
_EXEC_SECTION = schema.Message(
    python=schema.Value(converter=str))

_RUNTIME_SCHEMA = schema.Message(
    name=schema.Value(converter=str),
    description=schema.Value(converter=str),
    author=schema.Value(converter=str),
    api_version=schema.Value(converter=str),
    generate_configs=schema.Message(
        python=schema.Value(converter=str),
        files_to_copy=schema.RepeatedField(element=schema.Value(converter=str)),
        ),
    detect=_EXEC_SECTION,
    collect_data=_EXEC_SECTION,
    pre_build=_EXEC_SECTION,
    post_build=_EXEC_SECTION)