NAME

BZ::Client::Component - Client side representation of Product Components in Bugzilla

VERSION

version 4.4004

SYNOPSIS

This class provides methods for accessing Product Component information in the Bugzilla server.

my $client = BZ::Client->new( url      => $url,
                              user     => $user,
                              password => $password );

my $id = BZ::Client::Component->create( $client, \%params );
my $changes = BZ::Client::Component->update( $client, \%params );
my $ids = BZ::Client::Component->delete( $client, \%params );

CLASS METHODS

This section lists the class methods, which are available in this module.

create

$id = BZ::Client::Component->create( $client, \%params );

Returns the ID of the newly created Component.

History

Added in Bugzilla 5.0.

Marked experiemental as of Bugzilla 5.0.

Parameters

Some params must be set, or an error will be thrown. These params are marked "Required".

name

name (string) The name of the new component.

Required.

product

product (string) The name of the product that the component must be added to. This product must already exist, and the user have the necessary permissions to edit components for it.

Required.

description

description (string) The description of the new component.

Required.

default_assignee

default_assignee (string) The login name of the default assignee of the component.

Required.

default_cc

default_cc (array) An array of strings with each element representing one login name of the default CC list.

default_qa_contact

default_qa_contact (string) The login name of the default QA contact for the component.

is_open

is_open (boolean) 1 if you want to enable the component for bug creations. 0 otherwise. Default is 1.

Returns

The ID of the newly-added component.

Errors

304 - Authorization Failure

You are not authorized to create a new component.

1200 - Component already exists

The name that you specified for the new component already exists in the specified product.

update

$changes = BZ::Client::Component->update( $client, \%params );
@changes = BZ::Client::Component->update( $client, \%params );

This allows you to update one or more components in Bugzilla.

History

Added in Bugzilla 5.0.

Parameters

You must set one or both of "ids" or "names" to select the Component to update.

Other parameters set or update values of the Component

ids

ids (array) Numeric ID's of the components that you wish to update.

names

names (array of hashes) Names of the components that you wish to update. The hash keys are product and component, representing the name of the product and the component you wish to change.

name

name (string) A new name for this component. If you try to set this while updating more than one component for a product, an error will occur, as component names must be unique per product.

description

description (string) The description of the new component.

Required.

default_assignee

default_assignee (string) The login name of the default assignee of the component.

Required.

default_cc

default_cc (array) An array of strings with each element representing one login name of the default CC list.

default_qa_contact

default_qa_contact (string) The login name of the default QA contact for the component.

is_open

is_open (boolean) 1 if you want to enable the component for bug creations. 0 otherwise.

Returns

An array of hashes with the following fields:

id

id (int) The ID of the component that was updated.

changes

The changes that were actually done on this component. The keys are the names of the fields that were changed, and the values are a hash with two keys:

added

added (string) The value that this field was changed to.

removed

removed (string) The value that was previously set in this field.

Note that booleans will be represented with the strings 1 and 0.

Here's an example of what a return value might look like:

[
  {
    id => 123,
    changes => {
      name => {
        removed => 'FooName',
        added   => 'BarName'
      },
      default_assignee => {
        removed => 'foo@company.com',
        added   => 'bar@company.com',
      }
    }
  }
]

Errors

51 - User does not exist

One of the contact e-mail addresses is not a valid Bugzilla user.

106 - Product access denied

The product you are trying to modify does not exist or you don't have access to it.

706 - Product admin denied

You do not have the permission to change components for this product.

105 - Component name too long

The name specified for this component was longer than the maximum allowed length.

1200 - Component name already exists

You specified the name of a component that already exists. (Component names must be unique per product in Bugzilla.)

1210 - Component blank name

You must specify a non-blank name for this component.

1211 - Component must have description

You must specify a description for this component.

1212 - Component name is not unique

You have attempted to set more than one component in the same product with the same name. Component names must be unique in each product.

1213 - Component needs a default assignee

A default assignee is required for this component.

delete

$ids = BZ::Client::Component->delete( $client, \%params );
@ids = BZ::Client::Component->delete( $client, \%params );

This allows you to delete one or more components in Bugzilla.

History

Added in Bugzilla 5.0.

Parameters

You must set one or both of these parameters.

ids

ids (array) Numeric ID's of the components that you wish to delete.

names

names (array of hashes). Names of the components that you wish to delete. The hash keys are product and component, representing the name of the product and the component you wish to delete.

Returns

An array of ID's that were deleted

Errors

106 - Product access denied

The product you are trying to modify does not exist or you don't have access to it.

706 - Product admin denied

You do not have the permission to delete components for this product.

1202 - Component has bugs

The component you are trying to delete currently has bugs assigned to it. You must move these bugs before trying to delete the component.

EXCEPTION HANDLING

See BZ::Client::Exception

SEE ALSO

BZ::Client, BZ::Client::API, Bugzilla API

AUTHORS

  • Dean Hamstead <dean@bytefoundry.com.au>

  • Jochen Wiedmann <jochen.wiedmann@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2021 by Dean Hamstad.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.