# Path: tackerclient/common/exceptions.py
# class TackerException(Exception):
# class TackerClientException(TackerException):
# class BadRequest(TackerClientException):
# class Unauthorized(TackerClientException):
# class Forbidden(TackerClientException):
# class NotFound(TackerClientException):
# class Conflict(TackerClientException):
# class InternalServerError(TackerClientException):
# class ServiceUnavailable(TackerClientException):
# class NetworkNotFoundClient(NotFound):
# class PortNotFoundClient(NotFound):
# class StateInvalidClient(BadRequest):
# class NetworkInUseClient(Conflict):
# class PortInUseClient(Conflict):
# class IpAddressInUseClient(Conflict):
# class InvalidIpForNetworkClient(BadRequest):
# class OverQuotaClient(Conflict):
# class IpAddressGenerationFailureClient(Conflict):
# class MacAddressInUseClient(Conflict):
# class ExternalIpAddressExhaustedClient(BadRequest):
# class NoAuthURLProvided(Unauthorized):
# class EndpointNotFound(TackerClientException):
# class EndpointTypeNotFound(TackerClientException):
# class AmbiguousEndpoints(TackerClientException):
# class RequestURITooLong(TackerClientException):
# class ConnectionFailed(TackerClientException):
# class SslCertificateValidationError(TackerClientException):
# class MalformedResponseBody(TackerClientException):
# class InvalidContentType(TackerClientException):
# class InvalidInput(TackerClientException):
# class UnsupportedCommandVersion(TackerClientException):
# class TackerCLIError(TackerException):
# class CommandError(TackerCLIError):
# class UnsupportedVersion(TackerCLIError):
# class TackerClientNoUniqueMatch(TackerCLIError):
#     def __init__(self, message=None, **kwargs):
#     def __str__(self):
#     def __init__(self, message=None, **kwargs):
#     def __init__(self, **kwargs):
# HTTP_EXCEPTION_MAP = {
#     400: BadRequest,
#     401: Unauthorized,
#     403: Forbidden,
#     404: NotFound,
#     409: Conflict,
#     500: InternalServerError,
#     503: ServiceUnavailable,
# }


from osc_lib.command import command
from tackerclient.common import exceptions
from tackerclient.i18n import _
#    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.




SUPPORTED_VERSIONS = [1, 2]


class VnfLcmVersions(command.ShowOne):
    _description = _("Show VnfLcm Api versions")

    def get_parser(self, prog_name):
        parser = super(VnfLcmVersions, self).get_parser(prog_name)
        parser.add_argument(
            '--major-version',
            metavar="<major-version>",
            type=int,
            help=_('Show only specify major version.'))
        return parser

    def take_action(self, parsed_args):
        v = None
        if parsed_args.major_version:
            if parsed_args.major_version not in SUPPORTED_VERSIONS:
                msg = _("Major version %d is not supported")
                reason = msg % parsed_args.major_version

# Path: tackerclient/common/exceptions.py
# class TackerException(Exception):
# class TackerClientException(TackerException):
# class BadRequest(TackerClientException):
# class Unauthorized(TackerClientException):
# class Forbidden(TackerClientException):
# class NotFound(TackerClientException):
# class Conflict(TackerClientException):
# class InternalServerError(TackerClientException):
# class ServiceUnavailable(TackerClientException):
# class NetworkNotFoundClient(NotFound):
# class PortNotFoundClient(NotFound):
# class StateInvalidClient(BadRequest):
# class NetworkInUseClient(Conflict):
# class PortInUseClient(Conflict):
# class IpAddressInUseClient(Conflict):
# class InvalidIpForNetworkClient(BadRequest):
# class OverQuotaClient(Conflict):
# class IpAddressGenerationFailureClient(Conflict):
# class MacAddressInUseClient(Conflict):
# class ExternalIpAddressExhaustedClient(BadRequest):
# class NoAuthURLProvided(Unauthorized):
# class EndpointNotFound(TackerClientException):
# class EndpointTypeNotFound(TackerClientException):
# class AmbiguousEndpoints(TackerClientException):
# class RequestURITooLong(TackerClientException):
# class ConnectionFailed(TackerClientException):
# class SslCertificateValidationError(TackerClientException):
# class MalformedResponseBody(TackerClientException):
# class InvalidContentType(TackerClientException):
# class InvalidInput(TackerClientException):
# class UnsupportedCommandVersion(TackerClientException):
# class TackerCLIError(TackerException):
# class CommandError(TackerCLIError):
# class UnsupportedVersion(TackerCLIError):
# class TackerClientNoUniqueMatch(TackerCLIError):
#     def __init__(self, message=None, **kwargs):
#     def __str__(self):
#     def __init__(self, message=None, **kwargs):
#     def __init__(self, **kwargs):
# HTTP_EXCEPTION_MAP = {
#     400: BadRequest,
#     401: Unauthorized,
#     403: Forbidden,
#     404: NotFound,
#     409: Conflict,
#     500: InternalServerError,
#     503: ServiceUnavailable,
# }


# Path: tackerclient/osc/common/vnflcm/vnflcm_versions.py
from osc_lib.command import command
from tackerclient.common import exceptions
from tackerclient.i18n import _

#    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.




SUPPORTED_VERSIONS = [1, 2]


class VnfLcmVersions(command.ShowOne):
    _description = _("Show VnfLcm Api versions")

    def get_parser(self, prog_name):
        parser = super(VnfLcmVersions, self).get_parser(prog_name)
        parser.add_argument(
            '--major-version',
            metavar="<major-version>",
            type=int,
            help=_('Show only specify major version.'))
        return parser

    def take_action(self, parsed_args):
        v = None
        if parsed_args.major_version:
            if parsed_args.major_version not in SUPPORTED_VERSIONS:
                msg = _("Major version %d is not supported")
                reason = msg % parsed_args.major_version

                raise exceptions.InvalidInput(reason=reason)