Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Storage Spaces through the Graph API #2471

Merged
merged 13 commits into from
Sep 9, 2021
Merged

Create Storage Spaces through the Graph API #2471

merged 13 commits into from
Sep 9, 2021

Conversation

refs
Copy link
Member

@refs refs commented Sep 6, 2021

Spaces can now be created on POST /drive/{drive-name}. Only users with the create-space permissions can perform this operation.

Allowed body form values are:

  • quota (bytes) maximum amount of bytes stored in the space.
  • maxQuotaFiles (integer) maximum amount of files supported by the space.

It also adds docs for the new API.

@update-docs
Copy link

update-docs bot commented Sep 6, 2021

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@refs refs requested a review from butonic September 7, 2021 13:04
@refs refs marked this pull request as ready for review September 8, 2021 09:06
@refs refs changed the title [WIP] Arbitrarily create storage spaces Create Storage Spaces through the Graph API Sep 8, 2021
@refs refs requested review from micbar and butonic September 8, 2021 09:29
@refs refs requested a review from C0rby September 8, 2021 11:44
Copy link
Contributor

@C0rby C0rby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. 👍

@micbar
Copy link
Contributor

micbar commented Sep 8, 2021

@refs @C0rby @butonic

I found it in the MS specs for /me/drives

post:
      tags:
        - me.drive
      summary: Create new navigation property to drives for me
      description: A collection of drives available for this user. Read-only.
      operationId: me.CreateDrives
      requestBody:
        description: New navigation property
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/microsoft.graph.drive'
        required: true
      responses:
        '201':
          description: Created navigation property.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/microsoft.graph.drive'
        default:
          $ref: '#/components/responses/error'

and for `/me/drives/{drive-id}

'/me/drives/{drive-id}':
    get:
      tags:
        - me.drive
      summary: Get drives from me
      description: A collection of drives available for this user. Read-only.
      operationId: me.GetDrives
      parameters:
        - name: drive-id
          in: path
          description: 'key: id of drive'
          required: true
          schema:
            type: string
          x-ms-docs-key-type: drive
        - name: $select
          in: query
          description: Select properties to be returned
          style: form
          explode: false
          schema:
            uniqueItems: true
            type: array
            items:
              enum:
                - id
                - createdBy
                - createdDateTime
                - description
                - eTag
                - lastModifiedBy
                - lastModifiedDateTime
                - name
                - parentReference
                - webUrl
                - driveType
                - owner
                - quota
                - sharePointIds
                - system
                - createdByUser
                - lastModifiedByUser
                - following
                - items
                - list
                - root
                - special
              type: string
        - name: $expand
          in: query
          description: Expand related entities
          style: form
          explode: false
          schema:
            uniqueItems: true
            type: array
            items:
              enum:
                - '*'
                - createdByUser
                - lastModifiedByUser
                - following
                - items
                - list
                - root
                - special
              type: string
      responses:
        '200':
          description: Retrieved navigation property
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/microsoft.graph.drive'
          links:
            createdByUser:
              operationId: me.Drives.GetCreatedByUser
              parameters:
                drive-id: $request.path.drive-id
            lastModifiedByUser:
              operationId: me.Drives.GetLastModifiedByUser
              parameters:
                drive-id: $request.path.drive-id
            following:
              operationId: me.Drives.ListFollowing
              parameters:
                drive-id: $request.path.drive-id
            items:
              operationId: me.Drives.ListItems
              parameters:
                drive-id: $request.path.drive-id
            list:
              operationId: me.Drives.GetList
              parameters:
                drive-id: $request.path.drive-id
            root:
              operationId: me.Drives.GetRoot
              parameters:
                drive-id: $request.path.drive-id
            special:
              operationId: me.Drives.ListSpecial
              parameters:
                drive-id: $request.path.drive-id
        default:
          $ref: '#/components/responses/error'
      x-ms-docs-operation-type: operation
    patch:
      tags:
        - me.drive
      summary: Update the navigation property drives in me
      description: A collection of drives available for this user. Read-only.
      operationId: me.UpdateDrives
      parameters:
        - name: drive-id
          in: path
          description: 'key: id of drive'
          required: true
          schema:
            type: string
          x-ms-docs-key-type: drive
      requestBody:
        description: New navigation property values
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/microsoft.graph.drive'
        required: true
      responses:
        '204':
          description: Success
        default:
          $ref: '#/components/responses/error'
      x-ms-docs-operation-type: operation
    delete:
      tags:
        - me.drive
      summary: Delete navigation property drives for me
      description: A collection of drives available for this user. Read-only.
      operationId: me.DeleteDrives
      parameters:
        - name: drive-id
          in: path
          description: 'key: id of drive'
          required: true
          schema:
            type: string
          x-ms-docs-key-type: drive
        - name: If-Match
          in: header
          description: ETag
          schema:
            type: string
      responses:
        '204':
          description: Success
        default:
          $ref: '#/components/responses/error'

@micbar
Copy link
Contributor

micbar commented Sep 8, 2021

@ownclouders
Copy link
Contributor

💥 Acceptance tests Core-API-Tests-ocis-storage-8 failed. The build is cancelled...

1 similar comment
@ownclouders
Copy link
Contributor

💥 Acceptance tests Core-API-Tests-ocis-storage-8 failed. The build is cancelled...

@ownclouders
Copy link
Contributor

💥 Acceptance tests Core-API-Tests-ocis-storage-8 failed. The build is cancelled...

@sonarcloud
Copy link

sonarcloud bot commented Sep 9, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@refs refs merged commit ecaee10 into master Sep 9, 2021
@delete-merged-branch delete-merged-branch bot deleted the spaces-crud branch September 9, 2021 18:47
ownclouders pushed a commit that referenced this pull request Sep 9, 2021
Merge: 33d3d13 dc7dce5
Author: Alex Unger <6905948+refs@users.noreply.github.com>
Date:   Thu Sep 9 20:47:03 2021 +0200

    Merge pull request #2471 from owncloud/spaces-crud
@micbar micbar mentioned this pull request Sep 15, 2021
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants