百度智能云

All Product Document

          Log Service

          Project Operations

          Create Project

          The following guidelines must be met when creating an instance name of a project:

          • Project name must be unique per account and per region
          • The project name shall not be longer than 128 characters.
          • Only these characters are permitted for the project name: a-z, A-Z, 0-9, '_', '-', '.'

          Use the following code to create a project.

          createProjectRequest := CreateProjectRequest{
              Name: "sdk-project-test",
          }
          err := BLS_CLIENT.CreateProject(createProjectRequest)
          if err != nil {
            fmt.Println("Create project failed: ", err)
          } else {
            fmt.Println('Create project success.')
          }

          Prompt:

          • Detailed parameter configuration and restrictions may refer to BLS API document CreateProject

          Get the specified Project

          With following codes, obtain the project details of the specified UUID

          describeProjectRequest := DescribeProjectRequest{
              UUID: "828ce801-7369-cdf8-d6fb-34a74ffe6d3e",
          }
          res, err := BLS_CLIENT.DescribeProject(describeProjectRequest)
          if err != nil {
            fmt.Println("Get project failed: ", err)
          } else {
            fmt.Println("project info: ", res)
          }

          Prompt:

          • Detailed parameter configuration and restrictions may refer to BLS API document DescribeProject

          Update the specified project

          With following codes, update the project information of the specified name

          updateProjectRequest := UpdateProjectRequest{
              UUID:        "828ce801-7369-cdf8-d6fb-34a74ffe6d3e",
              Description: "test",
              Top:         true,
          }
          err = BLS_CLIENT.UpdateProject(updateProjectRequest)
          if err != nil {
            fmt.Println("Update project failed: ", err)
          } else {
            fmt.Println("Update project success.")
          }

          Prompt:

          • Detailed parameter configuration and restrictions may refer to BLS API document UpdateProject

          Get the project list

          Use the following code to fetch the project list saved by the current user.

          //Optional parameter list
          listProjectRequest := ListProjectRequest{
              Name:        "m",
              Order:       "desc",
              OrderBy:     "",
              PageNo:      1,
              PageSize:    20,
          }
          res, err := BLS_CLIENT.ListProject(listProjectRequest)
          if err != nil {
            fmt.Println("List project failed: ", err)
          } else {
            fmt.Println("Project list: ", res)
          }

          Prompt:

          • Detailed parameter configuration and restrictions may refer to BLS API document ListProject

          Delete the specified project

          Use the following code to delete a specified project identified by its UUID.

          deleteProjectRequest := DeleteProjectRequest{
              UUID: "828ce801-7369-cdf8-d6fb-34a74ffe6d3e",
          }
          err = BLS_CLIENT.DeleteProject(deleteProjectRequest)
          if err != nil {
            fmt.Println("Delete project failed: ", err)
          } else {
            fmt.Println("Delete project success.")
          }

          Prompt:

          • Detailed parameter configuration and restrictions may refer to BLS API document DeleteProject
          Previous
          Install the SDK Package
          Next
          LogStore Operations