예제 #1
0
def delete_app(name):
    # Enter a context with an instance of the API client
    with pensando_dss.psm.ApiClient(configuration) as api_client:
        # Create an instance of the API class
        api_instance = security_v1_api.SecurityV1Api(api_client)
        o_name = name # str | 

        # example passing only required values which don't have defaults set
        try:
            # Delete VirtualRouter object
            api_response = api_instance.delete_app1(o_name)
            pprint(api_response)
        except pensando_dss.psm.ApiException as e:
            print("Exception when calling NetworkV1Api->delete_app1: %s\n" % e)
예제 #2
0
def create_app(input_file):
    if not input_file:
        print("\n**input yaml file is missing**\n")
        os.system("python3 dss_app_create.py --help")
        exit()
    with open(input_file, 'r') as fp:
        input = yaml.safe_load(fp)
        validate_input_file(input, 'App')
    # Enter a context with an instance of the API client
    with pensando_dss.psm.ApiClient(configuration) as api_client:
        # Create an instance of the API class
        api_instance = security_v1_api.SecurityV1Api(api_client)
        # example passing only required values which don't have defaults set
        try:
            for item in input['App']:
                body = get_app_body(item)
                api_response = api_instance.add_app1(body)
                pprint(api_response.to_dict())

        except pensando_dss.psm.ApiException as e:
            print("Exception when calling SecurityV1Api->add_app1: %s\n" % e)
예제 #3
0
def create_security_policy(input_file):
    if not input_file:
        print("\n**input yaml file is missing**\n")
        os.system("python3 dss_security_policy_create.py --help")
        exit()
    with open(input_file, 'r') as fp:
        input = yaml.safe_load(fp)
        validate_input_file(input, 'Security_policy')

    for item in input['Security_policy']:
        with pensando_dss.psm.ApiClient(configuration) as api_client:
            # Create an instance of the API class
            api_instance = security_v1_api.SecurityV1Api(api_client)
            body = get_security_policy_body(item)
            # example passing only required values which don't have defaults set
            try:
                # Create NetworkSecurityPolicy object
                api_response = api_instance.add_network_security_policy1(body)
                pprint(api_response)
            except pensando_dss.psm.ApiException as e:
                print(
                    "Exception when calling SecurityV1Api->add_network_security_policy1: %s\n"
                    % e)
예제 #4
0
from pensando_dss.psm.models.security import *
from pprint import pprint
from dss_common import *
from dateutil.parser import parse as dateutil_parser

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = pensando_dss.psm.Configuration(
    psm_config_path=os.environ["HOME"] + "/.psm/config.json",
    interactive_mode=True)
configuration.verify_ssl = False

# Enter a context with an instance of the API client
with pensando_dss.psm.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = security_v1_api.SecurityV1Api(api_client)
    o_name = "O.name_example"  # str | Name of the object, unique within a Namespace for scoped objects. Must start and end with alpha numeric and can have alphanumeric, -, _, . Length of string should be between 2 and 64. (optional)
    o_tenant = "O.tenant_example"  # str | Tenant to which the object belongs to. This can be automatically filled in many cases based on the tenant the user, who created the object, belongs to. Must be alpha-numerics. Length of string should be between 1 and 48. (optional)
    o_namespace = "O.namespace_example"  # str | Namespace of the object, for scoped objects. Must start and end with alpha numeric and can have alphanumeric, -, _, . Length of string should be between 2 and 64. (optional)
    o_generation_id = "O.generation-id_example"  # str | GenerationID is the generation Id for the object. This is incremented anytime there is an update to the user intent, including Spec update and any update to ObjectMeta. System generated and updated, not updatable by user. (optional)
    o_resource_version = "O.resource-version_example"  # str | Resource version in the object store. This is updated anytime there is any change to the object. System generated and updated, not updatable by user. (optional)
    o_uuid = "O.uuid_example"  # str | UUID is the unique identifier for the object. This is generated on creation of the object. System generated, not updatable by user. (optional)
    o_creation_time = dateutil_parser(
        '1970-01-01T00:00:00.00Z'
    )  # datetime | CreationTime is the creation time of the object. System generated and updated, not updatable by user. (optional)
    o_mod_time = dateutil_parser(
        '1970-01-01T00:00:00.00Z'
    )  # datetime | ModTime is the Last Modification time of the object. System generated and updated, not updatable by user. (optional)
    o_self_link = "O.self-link_example"  # str | SelfLink is a link for accessing this object. When the object is served from the API-GW it is the URI path. Example: - \"/v1/tenants/tenants/tenant2\" System generated and updated, not updatable by user. (optional)
    label_selector = "label-selector_example"  # str | LabelSelector to select on labels in list or watch results. (optional)
    field_selector = "field-selector_example"  # str | FieldSelector to select on field values in list or watch results. (optional)