def create(cls,
               name,
               title,
               description,
               owners=None,
               readers=None,
               writers=None,
               vector_client=None):
        """
        Create a vector product in your catalog.

        Example
        -------
        >>> from descarteslabs.vectors import FeatureCollection
        >>> FeatureCollection.create(name='foo',
        ...    title='My Foo Vector Collection',
        ...    description='Just a test')  # doctest: +SKIP
        """
        params = dict(
            name=name,
            title=title,
            description=description,
            owners=owners,
            readers=readers,
            writers=writers,
        )

        if vector_client is None:
            vector_client = Vector()

        return cls._from_jsonapi(
            vector_client.create_product(**params).data, vector_client)
Exemplo n.º 2
0
    def create(cls,
               product_id,
               title,
               description,
               owners=None,
               readers=None,
               writers=None,
               vector_client=None):
        """
        Create a vector product in your catalog.

        Parameters
        ----------
        product_id : str
            A unique name for this product. In the created
            product a namespace consisting of your user id (e.g.
            "ae60fc891312ggadc94ade8062213b0063335a3c:") or your organization id (e.g.,
            "yourcompany:") will be prefixed to this, if it doesn't already have one, in
            order to make the id globally unique.
        title : str
            A more verbose and expressive name for display purposes.
        description : str
            Information about the `FeatureCollection`, why it exists,
            and what it provides.
        owners : list(str), optional
            User, group, or organization IDs that own
            the newly created FeatureCollection.  Defaults to
            [``current user``, ``current org``].
            The owner can edit and delete this `FeatureCollection`.
        readers : list(str), optional
            User, group, or organization IDs that can read
            the newly created `FeatureCollection`.
        writers : list(str), optional
            User, group, or organization IDs that can edit
            the newly created `FeatureCollection` (includes read permission).

        Example
        -------
        >>> from descarteslabs.vectors import FeatureCollection
        >>> FeatureCollection.create(product_id='foo',
        ...    title='My Foo Vector Collection',
        ...    description='Just a test')  # doctest: +SKIP
        """
        params = dict(
            product_id=product_id,
            title=title,
            description=description,
            owners=owners,
            readers=readers,
            writers=writers,
        )

        if vector_client is None:
            vector_client = Vector()

        return cls._from_jsonapi(
            vector_client.create_product(**params).data, vector_client)
    def create(cls,
               name,
               title,
               description,
               owners=None,
               readers=None,
               writers=None,
               vector_client=None):
        """
        Create a vector product in your catalog.

        Parameters
        ----------
        name : str
            A short name without spaces (like a handle).
        title : str
            A more verbose and expressive name for display purposes.
        description : str
            Information about the `FeatureCollection`, why it exists,
            and what it provides.
        owners : list(str), optional
            User, group, or organization IDs that own
            the newly created FeatureCollection.  Defaults to
            [``current user``, ``current org``].
            The owner can edit and delete this `FeatureCollection`.
        readers : list(str), optional
            User, group, or organization IDs that can read
            the newly created `FeatureCollection`.
        writers : list(str), optional
            User, group, or organization IDs that can edit
            the newly created `FeatureCollection` (includes read permission).

        Example
        -------
        >>> from descarteslabs.vectors import FeatureCollection
        >>> FeatureCollection.create(name='foo',
        ...    title='My Foo Vector Collection',
        ...    description='Just a test')  # doctest: +SKIP
        """
        params = dict(
            name=name,
            title=title,
            description=description,
            owners=owners,
            readers=readers,
            writers=writers,
        )

        if vector_client is None:
            vector_client = Vector()

        return cls._from_jsonapi(
            vector_client.create_product(**params).data, vector_client)
    def create(
        cls,
        product_id,
        title,
        description,
        owners=None,
        readers=None,
        writers=None,
        vector_client=None,
    ):
        """
        Create a vector product in your catalog.

        Parameters
        ----------
        product_id : str
            A unique name for this product. In the created
            product a namespace consisting of your user id (e.g.
            "ae60fc891312ggadc94ade8062213b0063335a3c:") or your organization id (e.g.,
            "yourcompany:") will be prefixed to this, if it doesn't already have one, in
            order to make the id globally unique.
        title : str
            A more verbose and expressive name for display purposes.
        description : str
            Information about the ``FeatureCollection``, why it exists,
            and what it provides.
        owners : list(str), optional
            User, group, or organization IDs that own
            the newly created FeatureCollection.  Defaults to
            [``current user``, ``current org``].
            The owner can edit and delete this ``FeatureCollection``.
        readers : list(str), optional
            User, group, or organization IDs that can read
            the newly created ``FeatureCollection``.
        writers : list(str), optional
            User, group, or organization IDs that can edit
            the newly created ``FeatureCollection`` (includes read permission).

        Returns
        -------
        :class:`FeatureCollection`
            A new ``FeatureCollection``.

        Raises
        ------
        ~descarteslabs.client.exceptions.BadRequestError
            Raised when the request is malformed, e.g. the supplied product id is already in use.
        ~descarteslabs.client.exceptions.RateLimitError
            Raised when too many requests have been made within a given time period.
        ~descarteslabs.client.exceptions.ServerError
            Raised when a unknown error occurred on the server.

        Example
        -------
        >>> from descarteslabs.vectors import FeatureCollection
        >>> FeatureCollection.create(product_id='my-vector-product-id',
        ...    title='My Vector Collection',
        ...    description='Just a test')  # doctest: +SKIP
        """
        params = dict(
            product_id=product_id,
            title=title,
            description=description,
            owners=owners,
            readers=readers,
            writers=writers,
        )

        if vector_client is None:
            vector_client = Vector()

        return cls._from_jsonapi(
            vector_client.create_product(**params).data, vector_client)