All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.codegen.model.service.ServiceModel Maven / Gradle / Ivy

/*
 * Copyright (c) 2016. Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 * http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file 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.
 */

package com.amazonaws.codegen.model.service;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Collections;
import java.util.Map;

public class ServiceModel {

    private final ServiceMetadata metadata;

    private Map operations;

    private Map shapes;
    private final Map authorizers;

    private String documentation;

    public ServiceModel(@JsonProperty(value = "metadata", required = true) ServiceMetadata metadata,
                        @JsonProperty(value = "operations", required = true) Map operations,
                        @JsonProperty(value = "shapes", required = true) Map shapes,
                        @JsonProperty(value = "authorizers") Map authorizers) {
        this.metadata = metadata;
        this.operations = operations;
        this.shapes = shapes;
        this.authorizers = authorizers;
    }

    public ServiceMetadata getMetadata() {
        return metadata;
    }

    public Map getOperations() {
        return operations;
    }

    public ServiceModel setOperations(Map operations) {
        this.operations = operations;
        return this;
    }

    /**
     * Convenience getter to retrieve an {@link Operation} by name.
     *
     * @param operationName Name of operation to retrieve.
     * @return Operation or null if not found.
     */
    public Operation getOperation(String operationName) {
        return operations.get(operationName);
    }

    public Map getShapes() {
        return shapes;
    }

    public ServiceModel setShapes(Map shapes) {
        this.shapes = shapes;
        return this;
    }

    /**
     * Convenience getter to retrieve a {@link Shape} by name.
     *
     * @param shapeName Name of shape to retrieve.
     * @return Shape or null if not found.
     */
    public Shape getShape(String shapeName) {
        return shapes.get(shapeName);
    }

    public String getDocumentation() {
        return documentation;
    }

    public void setDocumentation(String documentation) {
        this.documentation = documentation;
    }

    public Map getAuthorizers() {
        return authorizers != null ? authorizers : Collections.emptyMap();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy